Parameters

name string Internal name (@name) of the xtk:option record

Returns

Examples

Native options for Delivery

getOption("NmsEmail_DefaultFromAddr"); // [email protected]
getOption("NmsEmail_DefaultReplyToAddr"); // [email protected]
getOption("NmsEmail_FromName"); // Brand
getOption("NmsServer_MirrorPageUrl"); // https://tracking.email.example.com
getOption("NmsTracking_ClickFormula"); // <% if(...
getOption("NmsTracking_OpenFormula"); // <%= "<img...

Native options for Workflow

getOption("XtkInstancePrefix"); // cus
getOption("NmsOperation_LimitConcurrency"); // 10
getOption("NmsServer_LastPostUpgrade"); // 9364

Native options for Database

getOption("Nms_DefaultRcpSchema"); // nms:recipient
getOption("WdbcTimeZone"); // France/Paris
getOption("XtkQuery_Schema_LineCount"); // 1000

The data type is defined in Schema xtk:common:

<enumeration basetype="byte" default="string" name="dataType">
  <!-- values from cvariant.h -->
  <value label="Text" name="string" value="6"/>
  <value label="Integer" name="long" value="3"/>
  <value label="Floating point" name="double" value="5"/>
  <value label="Date+Time" name="timestamp" value="7"/>
  <value label="Long text" name="memo" value="12"/>
</enumeration>

Combined with one field for each type:

<element name="variant">
  <attribute enum="xtk:common:dataType" label="Data type" name="dataType" type="byte"/>
  <attribute desc="Value for text data" label="Value (text)" length="255" name="stringValue"
              type="string"/>
  <attribute default="0" desc="Value for integer data" label="Value (integer)"
              name="longValue" type="long"/>
  <attribute default="0" desc="Value for float data" label="Value (float)" name="doubleValue"
              type="double"/>
  <attribute desc="Value for date data" label="Value (date)" name="timeStampValue"
              type="datetime"/>
  <element desc="Value for memo data" label="Value (long text)" name="memoValue"
            type="memo"/>
</element>

Unit tests

Tested with acc by running acc instance exec -f test/integration/getOption.spec.js in a sandbox:

loadLibrary("/nl/core/shared/nl.js"); // import NL.assert
context.test1 = NL.assert(typeof getOption === "function");
context.test2 = NL.assert(typeof getOption("NmsEmail_DefaultFromAddr") === "string");
context.test3 = NL.assert(typeof getOption("Nms_DefaultRcpSchema") === "string");
context.test4 = NL.assert(typeof getOption("NmsOperation_LimitConcurrency") === "number");

See also

  • 📕 sqlSelect - Run a raw SQL SELECT and returns an XML collection. Prefer queryDef for higher abstraction.
  • 📕 setOption - Helper to write an instance-specific setting in the native xtk:option schema, useful for environment variable.