SmartConnect 2018

Data Variables

Data variables are defined by the source data defined on a map, and are passed (when required) into map scripts. A data variable is always the name of the data source field preceded by and underscore (_). i.e. a field CUSTNMBR in a data source would be _CUSTNMBR for scripting purposes.

 

Data variables are available for the following functions:

Definition of a maps tenants
Map line restrictions
Calculation columns
Map document tasks - specifically (tasks that run before each document, and tasks that run if the document succeeds or fails)

 

Data variables are displayed in the tree view on the left of the scripting window. They are also added to variable lookup lists for tasks where they are available.

 

When using a data variable in scripts care should be taken to ensure that the correct type of the variable is respected. All variables within SmartConnect are treated as string, and as such scripts should treat the variable as string even though the underlying data source field may not be a string.

 

e.g. A script to check a document for a specific customer class, where the customer is on hold.  Even though HOLD is a tinyint column in MSSQL it should be treated as a string for scripting.

 

VB.NET

if (_CUSTCLAS = "TESTCLASS" and _HOLD = "1") then

 return true

else

 return false

end if

 

C#.NET

if(_CUSTCLAS == 'TESTCLASS' && _HOLD == '1') {

 return true; }

else {

 return false; }