Forcing Reference to Fields and Share Names |
In order for
Conditional statements execute different "branches" of code, depending on how a conditional expression is evaluated. Accordingly, some code may not get executed, depending on the conditions at the time of the evaluation. This can cause a problem if a reference to a field or share name happens to be in code that gets skipped during
The Script Assistant includes two functions that force a script to reference a database field or data source name. These functions don't change or assign any values, they simply force
To find the following two functions in the Script Assistant, double-click on Functions and then Declarations in the Category option. Then double-click on the desired reference function and field or share name in the Names option. The reference functions are best inserted into the beginning of your script before any conditional statements.
To Force Reference to a Data File Field
ReferenceField("field_name_or_field_number")
If the document is set up to read data from a regular text file, you will specify a field number. When reading from a database, you will specify a field name. Unless the field name itself is contained in a variable, be sure to put the name in quotes, such as ReferenceField("price").
To Force Reference to a Shared Data Source
ReferenceSharedSubString("share_name")
If you have given any data sources in the template a share name, you can force reference to them as shown above. (Unless the share name is stored in a variable, be sure to put quotes around it.)