|
Tip>Designer |
|
|
Creating a named reference to another object |
|
|
Article #: |
0018 |
|
Contributor: |
Daniel Todes |
|
GF version: |
All |
|
Applies to: |
Variables at run time |
|
Last updated: |
October 18, 2001 |
Description
At run time, create a named reference to an object from within a FillPoint.
Explanation
You can store a reference to an object in a new variable. This is a pointer to the original object, and you can then use the new variable to refer to the properties of the original object.
This is particularly useful if the object is part of a hierarchy of several objects, i.e. the dot notation is unwieldy.
Click here to view step-by-step examples.
You can use this feature to shorten template variable names if you have many nested sub-Dialogs:
The following notation refers to the CurtainDetails sub-Dialog:
%[Suburb.House.Kitchen.CurtainDetails]
A FillPoint accessing the Color field in the sub-Dialog will then read:
%[Suburb.House.Kitchen.CurtainDetails.Color]
You can create a variable that will refer to this entire chain of sub-Dialogs:
%[Curtain=Suburb.House.Kitchen.CurtainDetails]
You can then access the Color field as follows:
%[Curtain.Color]
You may also have a situation similar to the following, where you represent two parties in a document:
Each of these parties can be either a Plaintiff or a Defendant. At run time, the user captures the details for the respective parties in two separate sub-Dialog Answer-sets. At this point, the user decides which party will be the Plaintiff and which party will be the Defendant. The chosen value can then be accessed using the following FillPoint:
%[Matter.PartyOne.LitigantType]
(where Matter is the name of the main Dialog and PartyOne is the name of the sub-Dialog.)
Likewise with the Matter.PartyTwo.LitigantType field.
You could then do something like this:
%[IfTrue(Matter.PartyOne.LitigantType='Defendant',Defendant = Matter.PartyOne, Plaintiff = Matter.PartyOne)]
Depending on which option the user chooses for the first party, you can create an instant, on-the-fly reference to the Matter.PartyOne object as either a DefendantorPlaintiff. Likewise for the second party you can create a reference to the details as either a DefendantorPlaintiff.
You can then use the following notation to refer to fields in the respective Dialogs depending on which party is the Plaintiff and which party is the Defendant:
%[Defendant.Name] and %[Plaintiff.Name]