{"id":5161,"date":"2017-09-21T23:24:48","date_gmt":"2017-09-21T23:24:48","guid":{"rendered":"https:\/\/alt2.minisoft.com\/support\/?p=5161"},"modified":"2021-02-09T15:28:53","modified_gmt":"2021-02-09T23:28:53","slug":"set-value-from-a-declared-constant","status":"publish","type":"post","link":"https:\/\/c002.minisoft.com\/support\/set-value-from-a-declared-constant\/","title":{"rendered":"Set Value from a Declared Constant"},"content":{"rendered":"<p>For examples on how to implement Declared Constants, consult the following: <a href=\"\/support\/index.php\/declared-constants-for-production-vs-dev-sandbox-accounts\/\">Declared Constants for Production vs. Dev\/Sandbox Accounts<\/a><\/p>\n<p>A Declared Constant from an eFORMzCfg_User.xml file provides the value for this Variable Function. The form of a declaration is:<\/p>\n<pre>&lt;Constant Name=\"OrderNbr\"&gt;\n &lt;![CDATA[Order Number]]&gt;\n&lt;\/Constant&gt;<\/pre>\n<p><!--[CDATA[Order Number]]-->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.<\/p>\n<h2>Language Substitution<\/h2>\n<p>Use eFORMzCfg_Translations.xml and update the values accordingly. A sample configuration is shown below:<\/p>\n<pre>&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\n&lt;eFORMzConfiguration&gt;\n &lt;Constant Name=\"OrderNbr_EN\"&gt;\n &lt;![CDATA[Order Number]]&gt;\n &lt;\/Constant&gt;\n &lt;Constant Name=\"OrderNbr_FR\"&gt;\n &lt;![CDATA[French Order Nbr]]&gt;\n &lt;\/Constant&gt;\n &lt;Constant Name=\"OrderNbr_GE\"&gt;\n &lt;![CDATA[German Order Number]]&gt;\n &lt;\/Constant&gt;\n &lt;KeyedConstant Name=\"OrderNbrLabels\"&gt;\n &lt;Entry Key=\"EN\"&gt;\n &lt;![CDATA[Order Number]]&gt;\n &lt;\/Entry&gt;\n &lt;Entry Key=\"FR\"&gt;\n &lt;![CDATA[French Order Nbr]]&gt;\n &lt;\/Entry&gt;\n &lt;Entry Key=\"GE\"&gt;\n &lt;![CDATA[German Order Number]]&gt;\n &lt;\/Entry&gt;\n &lt;\/KeyedConstant&gt;\n&lt;\/eFORMzConfiguration&gt;<\/pre>\n<p>In the eFORMzCfg_User.xml file, enter the eFORMzCfg_Translations.xml file name and its directory:<\/p>\n<pre>&lt;File Name=\"\\Projects\\Documentation\\eFORMzCfg_Translations.xml\"\/&gt;<\/pre>\n<p>From there, a report built with the Document Template can be configured for language substitution.<\/p>\n<p>1. First, create a Variable by right-clicking the Form and selecting Add Variable &gt; By position.<br \/>\n2. Enter \u2018Language\u2019 in the Name field and select OK.<br \/>\n3. Add another Variable by position. Enter \u2018OrderNbrConstantName\u2019 in the Name field.<br \/>\n4. Right click the Variable and select Add Function &gt; Set Value.<br \/>\n5. Enter a Constant value of &#8216;OrderNbr_&#8217; and select OK.<br \/>\n6. Right click the Variable and select Add Function &gt; Concatenate.<br \/>\n7. Select the Language Variable.<br \/>\n8. Add another Variable by position and enter the name &#8216;OrderNbrLabel.&#8217;<br \/>\n9. Right click the Variable and select Add Function &gt; Set value from a declared constant.<br \/>\n10. Select the \u2018OrderNbrConstantName\u2019 Variable.<\/p>\n<p>The \u2018OrderNbrConstantName\u2019 Variable has been set to &#8216;OrderNbr_&#8217; and the concatenated value of the \u2018Language\u2019 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:<\/p>\n<pre>&lt;Constant Name=\"OrderNbr_EN\"&gt;\n &lt;![CDATA[Order Number]]&gt;\n &lt;\/Constant&gt;\n &lt;Constant Name=\"OrderNbr_FR\"&gt;\n &lt;![CDATA[French Order Nbr]]&gt;\n &lt;\/Constant&gt;\n &lt;Constant Name=\"OrderNbr_GE\"&gt;\n &lt;![CDATA[German Order Number]]&gt;\n&lt;\/Constant&gt;<\/pre>\n<p>For example, if the language code is &#8216;FR&#8217; then the value of &#8216;OrderNbrConstantName&#8217; will be &#8216;OrderNbr_FR&#8217; and the value of the &#8216;OrderNbrLabel&#8217; Variable will be the French Order Number.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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: &lt;Constant Name=&#8221;OrderNbr&#8221;&gt; &lt;![CDATA[Order Number]]&gt; &lt;\/Constant&gt; If this Function is used in a number of Projects to refer [&hellip;]<\/p>\n","protected":false},"author":75,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[682],"_links":{"self":[{"href":"https:\/\/c002.minisoft.com\/support\/wp-json\/wp\/v2\/posts\/5161"}],"collection":[{"href":"https:\/\/c002.minisoft.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/c002.minisoft.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/c002.minisoft.com\/support\/wp-json\/wp\/v2\/users\/75"}],"replies":[{"embeddable":true,"href":"https:\/\/c002.minisoft.com\/support\/wp-json\/wp\/v2\/comments?post=5161"}],"version-history":[{"count":5,"href":"https:\/\/c002.minisoft.com\/support\/wp-json\/wp\/v2\/posts\/5161\/revisions"}],"predecessor-version":[{"id":8952,"href":"https:\/\/c002.minisoft.com\/support\/wp-json\/wp\/v2\/posts\/5161\/revisions\/8952"}],"wp:attachment":[{"href":"https:\/\/c002.minisoft.com\/support\/wp-json\/wp\/v2\/media?parent=5161"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/c002.minisoft.com\/support\/wp-json\/wp\/v2\/categories?post=5161"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/c002.minisoft.com\/support\/wp-json\/wp\/v2\/tags?post=5161"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}