TOPIC: Making an IdControl dependent on another?
#1533
Making an IdControl dependent on another? 11 Months ago
I have a table named ac_category and ac_class. ac_class depends on ac_category. So, for any given ac_category, there will be some records that are valid from ac_class. Thus, I would like to use IdControls as lookup for the two, but once a category is selected, I only want relating ac_class records to appear in the ac_class IdControl. For example

Code:


Category         Class
-----------------------------------------
Airplane         Single-engine land
Airplane         Single-engine sea
...
Rotorcraft       Helicopter
Rotorcraft       Gyroplane
Lighter-than-air Airship
Lighter-than-air Balloon
... etc ...



So, when one selects Rotorcraft, I want Helicopter and Gyroplane to be the only valid options for the class.

Jeremy
 
 
#1536
Re:Making an IdControl dependent on another? 11 Months ago
You should be able to use the whereField option. There's a bit of a description in the Users Manual under KeyControl

If the query needs to be restricted based on a field's value in the current record, then that field can be specified as the whereField argument. For example, you might have a contact lookup where you only want contacts for the current customer that is associated with the record. In this case the whereField would be the customer field. The field name from the current record must match the field name in the query. If this is not the case, then a rename can be done on the query to make the field names match.

You can find uses of this in the accounting application.
 
 
andrew
 
#1539
Re:Making an IdControl dependent on another? 11 Months ago
Oh. For some reason I was thinking on the lines of a combo box needing to be repopulated when a new item was selected, and speaking of, I think a combo box would be a better control for this situation. I'll play around with this and see what I can figure out.

Jeremy
 
 
#1542
Re:Making an IdControl dependent on another? 10 Months, 4 Weeks ago
Another option, if the list is not too big, is to use ChooseListControl with the listField option to get the list with a rule. (Briefly explained in the documentation.)
 
 
Last Edit: 2009/09/28 02:27 By andrew.
 
andrew