Result.RecordsMatched
Syntax
Result.RecordsMatched
Description
For this record, the number of records that matched the matching or lookup criteria from a previous block operation.
In general, the value of this field should be 0, no records matched, or 1, a single match was found.
Arguments
None
Returns
If Result.Success returns TRUE, then Result.RecordsMatched returns the number of matches from a previous Block operation. The possible results are 0, 1, or 2. A result of 2 indicates that more than one record was found.
If Result.Success returns FALSE, the value of Result.RecordsMatched is unpredictable.
Example
The Result.RecordsMatched result field is often used in conjunction with a Lookup block and an If/Else Control block to determine if the value specified in the lookup exists.
For example, assume you have the following flow:
On the Lookup Criteria tab of the Lookup Account block, specify:
CustomerNumber equals account.accountnumber
Then use an If/Else block with the Result.RecordsMatched field to determine if a match was found indicating that the record exists., as follows:
where Customers is the target entity.
- If Result.RecordsMatched does equal 0, then the record does not exist and in the next step, you create a new record.
- If Result.RecordsMatched equals 1 indicating that the If condition is false, then the record already exists and you update it.
- If Result.RecordsMatched equals 2, then there are 2 or more record matches; which may indicate an error.