Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
can we assign a field value to a variable in qlikview , if yes then how ?
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
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.
if i want static variable, and value come from calculating (like expression).
can i set static variable? how? thanks