[@Variant]
(As of 3.1.001.25)
Select a variant of an Object
Section names starting with an '@' character are processed at the start of each document (rather than the usual start-of-job) This means they affect each document individually.
The @Variant
action is to rename an object. It is typically used with Panes when a table or structure may want a slightly different layout of a table row or other collection of fields for different customers - but all using the same form template.
Consider a form that displays a repeating row of data called 'Detail'. Normally you would create a Pane or Row in the form design called 'Detail' and put the data fields inside it. But in this case, the layout of that 'Detail' row must appear differently depending on some customer/subsidiary field called 'Style'. This can be achieved with a single form using the [@Variant]
profile option.
The designer creates (say) 3 different variants of the pane - called 'OptionOne', 'OptionTwo', and 'OptionThree'. We add a field named, for example, 'Style' into the data file with a value of 'One', 'Two', or 'Three'. This appears in each <document>
of the file. The data for the pane continues to exist in the data stream under the name 'Detail'.
In the profile, the following appears:
[@Variant] Detail = Option[Style]
Now when the data file is processed, the value of field 'Style' is appended to the string 'Option' to become a name such as 'OptionTwo'. The resulting named object in the design is renamed to the name 'Detail'. The resulting Merge of the data that follows then uses variant 'OptionTwo' of the pane.
Each <document>
can have a different value for the field 'Style', and hence, generate a different variation of the Detail row.