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

Announcements
AWS Degraded - You may experience Community slowness, timeouts, or trouble accessing: LATEST HERE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Variable not evaluating correctly

Hi,

I have a variable in the application which is not evaluating correctly. The code for this variable is




=
'FIELDVALUE('CurrentQtrYear1',FieldIndex('CurrentQtrYear',GetFieldSelections(CurrentQtrYear)))'


The fields 'CurrentQtrYear' and 'CurrentQtrYear1' belong to same table. I am trying to get the value of 'CurrentQtrYear1' for value selected for 'CurrentQtrYear'. When I put the above code in a text box, it evaluates properly but when I try to do this through a variable, it does not work.

Any suggestyions?

Thanks

Amit

1 Solution

Accepted Solutions
Not applicable
Author

I'm not sure what the problem is here, but I would try removing the single quotes around the entire function. Using a QlikView file that I have (different field names), I was able to get this to resolve in a text box:

=FIELDVALUE('Customer',FieldIndex('FK',GetFieldSelections(FK)))


Then, I created a variable (vVal) and set it to:

=FIELDVALUE('Customer',FieldIndex('FK',GetFieldSelections(FK)))


Then in a text box, the following expression gets the same result as the one above:

=vVar


Using single quotes around the entire expression didn't work. This resolved to null:

='FIELDVALUE('Customer',FieldIndex('FK',GetFieldSelections(FK)))'


What happens when you try to use a variable? Is it always null? Are you using multiple selections? This only seems to work on single selections both using a variable and without.

View solution in original post

2 Replies
Not applicable
Author

I'm not sure what the problem is here, but I would try removing the single quotes around the entire function. Using a QlikView file that I have (different field names), I was able to get this to resolve in a text box:

=FIELDVALUE('Customer',FieldIndex('FK',GetFieldSelections(FK)))


Then, I created a variable (vVal) and set it to:

=FIELDVALUE('Customer',FieldIndex('FK',GetFieldSelections(FK)))


Then in a text box, the following expression gets the same result as the one above:

=vVar


Using single quotes around the entire expression didn't work. This resolved to null:

='FIELDVALUE('Customer',FieldIndex('FK',GetFieldSelections(FK)))'


What happens when you try to use a variable? Is it always null? Are you using multiple selections? This only seems to work on single selections both using a variable and without.

Not applicable
Author

Thanks, this works.

I was trying to use the variable in set analysis and in text box and used $(vVar) at both the places. Finally it worked with $(vVar) in set analysis and vVar in text box.

Thanks once again.

Amit