← Strings and Text

Find the Recipe

medium

Looks up a scanned code in a table of recipe codes and reports its line speed.

What it teaches

FIND searches inside one STRING; it cannot search an array of them, so a lookup compares the code with the table's elements one by one. 'RCP-104' is element 3, and when a code appears twice the first one wins. When nothing matches, the result has to say so, or element 0 looks like a match. An empty scan matches nothing, not even an empty slot in the table, where '' equals ''. The comparison is exact, so 'rcp-104' and a scan still ending in $r match nothing; clean the scan first, as the reply was cleaned in Strip the Terminator.

Parameters

TagDirectionTypeDefaultDescription
Sts_FoundOutputBOOL0A recipe code matches the scan
Out_IndexOutputDINT0The matching element, or -1
Out_SpeedOutputDINT0The matching recipe line speed, or 0
Ref_ScanInOutSTRING—The scanned recipe code
Ref_CodesInOutSTRING[8]—The recipe codes
Ref_SpeedsInOutDINT[8]—Line speed for each recipe

Required behavior