i have a table and i need to read data from this table in my script, record by record and do some action.
To reed data from this table i can use "peek" in a for loop, or use "Lookup" with a key field.
Becuse my table hat too many recods, it's really slow.
1. Any body has an idea which one is faster? PEEK or LOOKUP?
2. Or somebody knows a better way to do that?
p.s. i have tried to use join or mapping but in this case it's not the answer. i know such problems can be solved without use of record by record loops, but here it's not the case. i need exactly what i explained.
If possible, can you share/explain some more details on excatly what you want do in action part.
However lookup and peek functions serves the similar function but used on different conditions:
lookup is a mapping or a translation function: You could for instance have a product ID and you want to translate that into a specific product attribute. In other words – you never expect more than one value for the specific product ID. If there are several possible values in the lookup table, the lookup function will just take the first one found.If you do expect several values for each of the input values, you should not use a lookup function to solve the problem.
in above, Lookup() function will return the value of the field ProductCategory (first parameter) in the table ProductTable (fourth parameter) from the record where the field ProductID (second parameter) has the same value as the field ProductID in the order data table (third parameter).
The Peek() function is similar to the Lookup() function, but instead of addressing the other table using a field value, the peek function needs a row number.
Peek ('ProductCategory', -1, 'ProductTable')
Although the Peek() function is a lookup function, its use for solving similar problems is limited since you need the row number to get the desired value, and this is rarely the case.