Excerpt here…
🐍👑🌍
“NL is not defined” exception
10/10/2019 9:56:45 AM js3 JST-310000 Error while compiling script 'WKF1096688/js3' line 2: NL is not defined.
NL.require('/nl/core/sql.js'); // @throws Exception
var enumName = 'city';
var enumId = sqlGetDouble ('SELECT iEnumId FROM xtkEnum WHERE sName='+NL.SQL.escape(enumName));
Add loadLibrary("/nl/core/shared/nl.js");
first:
loadLibrary("/nl/core/shared/nl.js");
NL.require('/nl/core/sql.js'); // OK
var enumName = 'city';
var enumId = sqlGetDouble ('SELECT iEnumId FROM xtkEnum WHERE sName='+NL.SQL.escape(enumName));
PS: doc for NL.SQL.escape
https://final-docs.campaign.adobe.com/doc/AC/en/jsapi/p-8.html
See NL.Locale to format prices tuto
##
function getEnumValue(enumName, valueName){
loadLibrary("/nl/core/shared/nl.js");
NL.require('/nl/core/sql.js');
var enumId = sqlGetDouble ('SELECT iEnumId FROM xtkEnum WHERE sName='+NL.SQL.escape(enumName));
var value = sqlGetString ('SELECT sLabel from xtkEnumValue WHERE iEnumId='+enumId+' AND sName='+NL.SQL.escape(valueName));
return value;
}
getEnumValue('dictionaryLocale', 'en_US') // "English (United States)"