D2 offers 2 ways of defining dependent fields on property sheets: Taxonomies and DQLs.
1. Taxonomy
To use a taxonomy, you must first configure (in D2-Config) N Dictionaries, then a taxonomy with N levels corresponding to N fields/attributes. For each level of the taxonomy specify the corresponding dictionary and desired values.
On the property sheet add the dependent fields (dropdownlists), then for each specify the type (Taxonomy), choose taxonomy name, the corresponding level and previous/next properties that must be updated when current field is changed. If no values are selected, the dependent fields will contain all the values from the corresponding Dictionary.
Here's a simple Country-City dependency:
2. DQL
On the first (master) attribute configuration add the dependent attributes in the field: 'In case of modification, reinitialize the following controls'.
On dependent attributes select type: DQL, then enter the DQL:
select dependent_attr from some_type where '$value(master_attr)'='' or master_attr='$value(master_attr)'
If you don't want to populate the dependent attribute until the master attribute is selected/entered, exclude the DQL clause: '$value(master_attr)'=''
1. Taxonomy
To use a taxonomy, you must first configure (in D2-Config) N Dictionaries, then a taxonomy with N levels corresponding to N fields/attributes. For each level of the taxonomy specify the corresponding dictionary and desired values.
On the property sheet add the dependent fields (dropdownlists), then for each specify the type (Taxonomy), choose taxonomy name, the corresponding level and previous/next properties that must be updated when current field is changed. If no values are selected, the dependent fields will contain all the values from the corresponding Dictionary.
Here's a simple Country-City dependency:
2. DQL
On the first (master) attribute configuration add the dependent attributes in the field: 'In case of modification, reinitialize the following controls'.
On dependent attributes select type: DQL, then enter the DQL:
select dependent_attr from some_type where '$value(master_attr)'='' or master_attr='$value(master_attr)'
If you don't want to populate the dependent attribute until the master attribute is selected/entered, exclude the DQL clause: '$value(master_attr)'=''
Maybe a little off-topic, but do you know how to trigger automatic dependent properties fetching when creating new document using D2FS createProperties operation?
ReplyDelete