Friday, March 22, 2013

D2 - Using dependent fields on property sheets

D2 offers 2 ways of defining dependent fields on property sheets: Taxonomies and DQLs.

1. Taxonomy

D2 Taxonomy configuration
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:
D2 property attribute taxonomy typeD2 property sheet dependent attributes

2. DQL

D2 property sheet refresh dependent attributesOn 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)'
D2 property sheet attribute DQL
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 comment:

  1. 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