Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

qlikview syntax

can we assign a field value to a variable in qlikview , if yes then how ?

3 Replies
Miguel_Angel_Baeyens

Hi,

There are at least couple of ways I think of to do that in the load script

LET vFieldValue = FieldValue('FieldName', 1);


This will look the value number 1 in the field FieldName and it will assign it to the vFieldValue variable.

LET vFieldValue2 = Peek('FieldName2', 0, 'Table');


This will store the first ("0") value of FieldName2 from table "Table" into variable vFieldValue2. Check the reference manual for further examples, though.

Hope that helps

Anonymous
Not applicable
Author

There are two questions here:

1. Can we assign a field value to a variable in qlikview
the answer is Yes.

2. How?
there are many ways, and the answer depends on what you want to do. Variable has one value at any given moment, but field usually has many values. So, the question is what value are you looking for.
Miguel showed how to assign value in the script. You can assign, for example, first value, or 2nd, or last value, etc.
You can assign value on the front end too, for example define variable this way if you want it to be max value of a numeric field:
=max(FieldName)
You can also to use macro to assign Field value to a variable. The major diference is that when you assign value by variable definition as above, it will be changed with selections immideately. When you assign it by a macro, it will be changed when the macro is triggered.

marcohadiyanto
Partner - Specialist
Partner - Specialist

if i want static variable, and value come from calculating (like expression).

can i set static variable? how? thanks