General structure of a smart parameter

A smart parameter can include any number of elements that are combined at run time to produce a single action argument.

Elements might include special variables, string constants, and navigation elements.
Restriction: Smart parameters do not work with all actions. Check the Action help in Datacap Studio for compatibility information.

Example 1

The following example shows an action with a single smart parameter argument that includes three smart parameter elements.

SetSourceDirectory("@Appath(vscandimagedir)+\+Input")
														
Table 1. Smart Parameter Elements in Example 1
Smart Parameter Element Description
@APPPATH(vscanimagedir) Special variable that gets a setting from the application configuration (.app) file. See the Special variables to access application configuration settings topic.
\ String constant
Input String constant

Elements are combined by using the ‘+' sign. At run time, Datacap first evaluates any special variables and then concatenates the elements to create a single string that becomes the action argument.

07:13:25.53 3 Smart Parameter elements found
07:13:25.53 Parsing Smart Parameter element {0} value: "@APPPATH(vscanimagedir)"
07:13:25.54 @APPPATH key root value: 'vscanimagedir'
07:13:25.54 @APPPATH looking for workflow key: '*/dco_TravelDocs/vscanimagedir'
07:13:25.54 workflow key found: 'C:\Datacap\TravelDocs\images'
07:13:25.54 Parsing Smart Parameter element {1} value: "\"
07:13:25.54 Parsing Smart Parameter element {2} value: "Input"
07:13:25.54 Smart Parameter return value: 'C:\Datacap\TravelDocs\images'
07:13:25.54 looking for:C:\Datacap\TravelDocs\images\Input
07:13:25.55 Action changes: Directory with source images: C:\Datacap\TravelDocs\images\Input

It is incorrect to specify the argument as @APPPATH(vscanimagedir)+\Input. The ‘\' sign when followed by a string represents a navigation element. See the Use navigation elements to access the runtime hierarchy topic. In this example, you do not want to specify a navigation element. Instead, you want to concatenate the result of @APPPATH(vscanimagedir) with the string \Input by using +\+Input.

Example 2

The next example shows an action with two smart parameter arguments. Each argument includes one smart parameter element:
rrSet ("..\Pickup Location","@B.FieldValue")
Table 2. Smart Parameter Arguments in Example 2
Smart Parameter Argument Description
..\Pickup_Location Navigation element that references another field on the same page within the runtime hierarchy
@B.FieldValue Special variable that references a batch level custom variable within the runtime hierarchy

The portion of the following log file shows how Datacap evaluates the first argument by recognizing it as a navigation element. It then goes to the referenced element within the runtime hierarchy and retrieves the value of the field. In this example, the action is bound to a field, so ..\Pickup_Location references another field at the same level on the same page.

08:17:30.892                action rrSet (str="..\Pickup_Location",str="@B.FieldValue")
08:17:30.892                   execute statement On Action Start
08:17:30.892                      executing code:
08:17:30.892                      Call OnActionStart()
08:17:30.892                   /execute statement On Action Start
08:17:30.892 1 Smart Parameter element found
08:17:30.892 Parsing Smart Parameter element {0} value: "..\Pickup_Location"
08:17:30.892 DCO Parent Navigation key match (starts with '\' or '..\'). Calling 
DCONavGetValue(..\Pickup_Location)
08:17:30.892 Finding Child 'Pickup_Location' -->
08:17:30.893 Found child 'Pickup_Location'
08:17:30.895 Finding Dictionary assigned to DCO Node:'Pickup_Location'
08:17:30.895 This DCO does not have an assigned Dictionary or is not an OMR type Field.
08:17:30.895 Smart Parameter return value: 'Orlando (MCO)'
08:17:30.896 Setting '20110054.002.FieldValue' value to 'Orlando (MCO)'.