Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

filtering a drop down list from another field 1

Status
Not open for further replies.

smartglass

IS-IT--Management
Mar 14, 2006
33
GB
Hi:
I have a large number of stock items in a requisition system. These can be grouped by department.
When placing a requisition I would like a user to be able to select a department (not always his own) and the drop down list of stocks available would then be filtered as a result of the department selected.
Thus if on a form a user selects field DEPT = "CLEANING", then drop down list for field STOCKS will be only those for the cleaning department.
Thanks in anticipation!
 
You can open a tcursor on an external table, set a range on it and use that table as the data source for the list.

I'm guessing you might place this on the changevalue method of DEPT, so it fires when a different dept is selected.
Code:
if not tc.open(":mylias:mydtasource.db")    then
  errorshow()
  return
endif
   tc.switchIndex("dpt") ;switch to the index on department
   tc.setrange(self.value,self.value); limit view to current department
   delayScreenUpdates(Yes)
   mylist'List.Count=0 ; initialize list
   scan tc:
      mylist'List.Selection=mylist'List.Count+1
      mylist'List.value=tc."stocks"
   endscan
   tc.close()
   delayScreenUpdates(No)

or if you have a table with only the list items already uniquely set aside, you can simply

(open())
Code:
DoDefault
self.DataSource = "[:myalias:mydtasource.LastName]"



Tony McGuire
"It's not about having enough time. It's about priorities.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top