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.
You can use peek outside a Load statement, but you need to specify the field name and the table name with single quotes:
Let vStatus = Peek('COLUMN1',0,'TABLE1');
This Let statement will assign the text 'RED' to the variable vStatus, butI am not sure I understand how you want to use it...
If you want to specify the color based on the value in field COLUMN2 - i.e. different colors in different lines of a table - then you should use the following color expression:
or if you consider the possiblity of COLUMN2 having several possible values:
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.
Variable_Question.qvw 145.0 K