Creating the Validate Car Type rule
You create the Validate Car Type rule in Datacap Studio.
Procedure
To create the Validate Car Type rule:
- In the Rulesets pane, make sure that the Validate ruleset is locked for editing.
- Right-click the Validate ruleset and choose Add Rule.
- Rename the new rule from Rule1 to Validate Car Type.
- Rename the default function from Function1 to Validation: Car Type.
- On the Actions library tab, expand the Lookup library and select the OpenConnection action.
- Make sure the Validation: Car Type function is selected in the Rulesets pane.
- Click Add to function at the left side of the Actions Library pane.
- Select the ExecuteSQL action and click Add to Function.
- Select the CloseConnection action and click Add to Function.
- Select the OpenConnection action
and in the Properties pane set the strParam parameter
to @APPVAR(*/lookupdb:cs).
This parameter is a Datacap smart parameter that obtains the connection string for the application's lookup database from the application configuration file.
- Select the ExecuteSQL action and
in the Properties pane set the sStringIn parameter
to "SELECT Car_Type FROM Car_Types WHERE Car_Type='%s';",Car_Type. Attention: You must use the syntax exactly as it is used here. You can copy and paste from here if necessary.
- In the Rulesets pane, click Save. Then, click Lock ruleset and choose Publish ruleset.
Parent topic: Use a lookup database to validate the car type