Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How can i make filter in a combo?
Message
From
12/07/2006 09:44:01
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
12/07/2006 09:01:56
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01135646
Message ID:
01135666
Views:
11
>I am trying to make a filter with 2 comboxes and a 2 cursors for example the cursor 1 is the rowsource of the combo 1, the cursor 2 is the rowsorce of the combo 2, i want to make a filter in the combo 2 with the combo 1 value. for example if the combo 1 value is 'city 1' so the combo 2 display only the data with a 'city 1' relation. i can do when i am making a new register but when i am trying to modify the register created with this method sometimes do but sometimes display my combo 2 clear without registers. this is a example of my code:
>
>&&This is the gotfocus method of my combo2:
>
>if !empty(combo1.value)
>	set exact off
>	set near on
>	select subclases1 &&cursor 2, the cursor 1 is filling the combo 1
>	go top
>	set filter to subclases1.clase=k_clase && public variable
>	locate for subclases1.subclase=val(thisform.nsubclase) &&form property
>	this.value=thisform.nsubclase
>else
>	select subclases1
>	set filter to subclases1.clase=k_clase
>endif
>set exact on
>set near on
>thisform.refresh
>
>i can make the filter only is i am makin a new register, but modifying not.
Set Textmerge delimiters to '%%','%%'
Public oForm
oForm = CreateObject('cmbLinked')
oForm.Show

Define Class cmbLinked As Form
  DataSession=2
  Height = 70
  Width = 615
  Add Object lblCustomer As Label With Caption="Customer ID:",Left=5,Top=5,Autosize=.t.
  Add Object lblOrders As Label With Caption="Orders:[0]",Left=310,Top=5,AutoSize=.t.
  Add Object cmbCustomer As ComboBox With Left=5,Top=30,Width=300
  Add Object cmbOrders As ComboBox With Left=310,Top=30,Width=300

  Procedure Init
    With This.cmbCustomer
      .RowSourceType = 3
      .RowSource = "select company,cust_id from customer into cursor cboAna"
    Endwith
    With This.cmbOrders
      .RowSourceType = 3
      .RowSource = "select order_id,order_date,cust_id"+;
        " from orders"+;
        " where cust_id = cboAna.cust_id"+;
        " into cursor cboAlt"
      .ColumnCount = 3
    Endwith
  Endproc

  Procedure cmbCustomer.InteractiveChange
  	Local lnOrders
    With This.Parent.cmbOrders
      .ListIndex=0
      .Requery()
      lnOrders = .ListCount
    Endwith
  	this.Parent.lblCustomer.Caption = "Customer ID:"+cboAna.Cust_id
  	this.Parent.lblOrders.Caption = Textmerge('Orders:[%%m.lnOrders%%]')
  Endproc
Enddefine
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform