Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear all,
see the example below:
load AAA from MYTABLE where MYFIELD = '1'
let MYVAR = peek('AAA')
load AAA from MYTABLE where MYFIELD = '2'
let MYVAR2 = peek('AAA')
The problem is rising when I don't find any records in the second loading. In this case MYVAR2 has the same value of MYVAR.
How can I avoid it ? Is there a way to insert a condition ?
Help please
Thanks in advance for your support
You could examine the number of records after the first load, then again after the second load to determine whether new records were concatenated.
LET vRecCount = NoOfRows('TableName');
Or you could load the AAA field to a temp field which is unique for both loads... so in the first load:
LOAD
AAA,
AAA as Tmp_AAA
Then in the second load:
LOAD
AAA,
AAA as Tmp2_AAA
Then you can peek at Tmp_AAA and Tmp2_AAA.
Then just Drop Fields to get rid of the fields after.
The peek function without the row parameter will give the last value of the field. If no rows were concatenated, then the value would remain the same. If you need to know the last values of both loads independently, then load the values into separate fields or tables. The tables can be concatenated together after running the peek function.
Thanks !!!!