Previous() and Peek() functions
Within the scripting language, there are two functions that appear to do the same thing. These are the Previous()
and Peek()
functions. However, there is a subtle difference between the two when it comes to the script, and it is not just the number of parameters.
The Peek()
function has a lot more parameters and can be used outside a Load
statement as well, but this is not the issue here.
The following two statements work in exactly the same way:
if(Previous([Manufacturer No])=[Manufacturer No],1) as SameManuf if(Peek('Manufacturer No')=[Manufacturer No],1) as SameManuf
Both check to see if the previous record had the same Manufacturer No
value (as long as data is sorted in this field). However, if we want to make a counter field, we can only use the Peek()
function as the Previous()
function must be used to refer to a field that actually exists in the source data.
Take a look at this statement:
if(Peek('Manufacturer No')=[Manufacturer No...