Latest News

the latest news from our team

Set Value from a Declared Constant

For examples on how to implement Declared Constants, consult the following: Declared Constants for Production vs. Dev/Sandbox Accounts

A Declared Constant from an eFORMzCfg_User.xml file provides the value for this Variable Function. The form of a declaration is:

<Constant Name="OrderNbr">
 <![CDATA[Order Number]]>
</Constant>

If this Function is used in a number of Projects to refer to the same Declared Constant, when the Declared Constant must change, only the eFORMzCfg_User.xml file needs to be modified, not each Project.

Language Substitution

Use eFORMzCfg_Translations.xml and update the values accordingly. A sample configuration is shown below:

<?xml version="1.0" encoding="UTF-8"?>
<eFORMzConfiguration>
 <Constant Name="OrderNbr_EN">
 <![CDATA[Order Number]]>
 </Constant>
 <Constant Name="OrderNbr_FR">
 <![CDATA[French Order Nbr]]>
 </Constant>
 <Constant Name="OrderNbr_GE">
 <![CDATA[German Order Number]]>
 </Constant>
 <KeyedConstant Name="OrderNbrLabels">
 <Entry Key="EN">
 <![CDATA[Order Number]]>
 </Entry>
 <Entry Key="FR">
 <![CDATA[French Order Nbr]]>
 </Entry>
 <Entry Key="GE">
 <![CDATA[German Order Number]]>
 </Entry>
 </KeyedConstant>
</eFORMzConfiguration>

In the eFORMzCfg_User.xml file, enter the eFORMzCfg_Translations.xml file name and its directory:

<File Name="\Projects\Documentation\eFORMzCfg_Translations.xml"/>

From there, a report built with the Document Template can be configured for language substitution.

1. First, create a Variable by right-clicking the Form and selecting Add Variable > By position.
2. Enter ‘Language’ in the Name field and select OK.
3. Add another Variable by position. Enter ‘OrderNbrConstantName’ in the Name field.
4. Right click the Variable and select Add Function > Set Value.
5. Enter a Constant value of ‘OrderNbr_’ and select OK.
6. Right click the Variable and select Add Function > Concatenate.
7. Select the Language Variable.
8. Add another Variable by position and enter the name ‘OrderNbrLabel.’
9. Right click the Variable and select Add Function > Set value from a declared constant.
10. Select the ‘OrderNbrConstantName’ Variable.

The ‘OrderNbrConstantName’ Variable has been set to ‘OrderNbr_’ and the concatenated value of the ‘Language’ Variable. This Variable is picking up the two-letter language code from the incoming data file. This corresponds to the format of the Declared Constants in the eFORMzCfg_Translations.xml file:

<Constant Name="OrderNbr_EN">
 <![CDATA[Order Number]]>
 </Constant>
 <Constant Name="OrderNbr_FR">
 <![CDATA[French Order Nbr]]>
 </Constant>
 <Constant Name="OrderNbr_GE">
 <![CDATA[German Order Number]]>
</Constant>

For example, if the language code is ‘FR’ then the value of ‘OrderNbrConstantName’ will be ‘OrderNbr_FR’ and the value of the ‘OrderNbrLabel’ Variable will be the French Order Number.

Leave a Reply

Your email address will not be published. Required fields are marked *