I have a table TABLE1 with two columns, COLUMN1 and COLUMN2
I am setting a variable in the script as below:
Let vStatus = Peek("COLUMN1",0,TABLE1);
I am trying to use this variable in text box background color as a calculated color as below
I always get green background for the text box. I tried hardcode value 10 in the let statement and that changes the color to Red. So somehow the Let statement with peek is not working. Need some advice and help!
You cann't use peek outside LOAD statement(below).
Use this function:
FieldValue(fieldname , n )
Returns the field value found in position n of the
field fieldname (by load order). fieldname must be given as a string value, e.g. the field
name must be enclosed by single quotes. The first field value is returned for
n=1. If n is larger than the
number of field values, NULL is returned.
Please check the Qlikview Reference manual for help on Peek() function. And it's clearly mentioned that peek() can be used outside the LOAD statement but with the TABLE name reference. The peek function searches for the Tables in the Qlikview database(which are already loaded in the qvw file). Peek() function syntax is wrong in your situation.
As suggested by Henric you can make use of the column in the table for changing the color based on value in the field rather than making use of variable.