Creating the Validate Car Type rule

You create the Validate Car Type rule in Datacap Studio.

Procedure

To create the Validate Car Type rule:

  1. In the Rulesets pane, make sure that the Validate ruleset is locked for editing.
  2. Right-click the Validate ruleset and choose Add Rule.
  3. Rename the new rule from Rule1 to Validate Car Type.
  4. Rename the default function from Function1 to Validation: Car Type.
  5. On the Actions library tab, expand the Lookup library and select the OpenConnection action.
  6. Make sure the Validation: Car Type function is selected in the Rulesets pane.
  7. Click Add to function at the left side of the Actions Library pane.
  8. Select the ExecuteSQL action and click Add to Function.
  9. Select the CloseConnection action and click Add to Function.
  10. 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.

  11. 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.
  12. In the Rulesets pane, click Save. Then, click Lock ruleset and choose Publish ruleset.