PopulateWithResult

Populates the current field with a value returned by the previous ExecuteSQL or LookupReturnValue action. If the previous action returned multiple values, you can specify the value that you want to use.

Syntax

bool PopulateWithResult (StrParam)

Parameters

  1. A number that indicates the value in a record that is retrieved by an earlier ExecuteSQL or SmartSQL action is to be assigned to the current Field object (and added to the Data file of the current page.)
    • "1" refers to the first column in a recordset, "2" refers to the second column, and so on.
  2. True or False. True causes the action to fail, if the action returns a recordset with multiple lines. False permits the action to accept a record set with multiple lines but to use values in the first record of the record set.

Returns

True, if the second parameter is True and a previous ExecuteSQL or SmartSQL action finds a recordset with only one record.

True, if the second parameter is "False" and a previous ExecuteSQL (or SmartSQL) action finds a recordset with one or more records.

Otherwise, False.

Level

Field level only.

Details

Populates a Field object with a database value retrieved by a ExecuteSQL or SmartSQLaction.

This action allows multiple rules to populate multiple Field objects with data from a single database record (see the following example.)

Example:
(Field #1)
OpenConnection("@APPVAR(*/lookupdb:cs)")
ExecuteSQL(""Select * From Vendor Where VendorID = %s;",VendorID")
PopulateWithResult("1,FALSE")

(Field #2)
PopulateWithResult("2,FALSE")

In the example, the ExecuteSQL action of the RuleSet applied to Field #1 retrieves the recordset (if it exists).

The PopulateWithResult action places the value of the first record's first column into the field where the rule applied. The PopulateWithResult action of a rule that is applied to Field #2 populates the field with the value of the first record's second column.

False means that the action can accept a recordset with multiple records but extracts values from the first record only.