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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Expression not working consistently

Hi,

I have an expression which works fine when put in a List Box. But when I put it in a text object or a button, it does not show the desired value and appears blank.

The expression looks like this:


=if(LabelName='xyz',$(Language))


${Language) is dynamic and evaluates to a field depending upon value passed to variable 'Language'.

Any suggestion/thoughts on this issue will be greatly appreciated.

Thanks

Amit

6 Replies
Not applicable
Author

Amit,

Look at the attached example. I have a variable var1 and assign the value 168. If i click "Account1" in the list object it showing the value else not showing the value. Hope this helps.

-Raghu

Anonymous
Not applicable
Author

Hi Amit,

Not having looked at the document I can't say for sure but it sounds like your field LabelName has more than one possible value.

If you select 'xyz' in the field, does the text object show the value like you expect?

The thing is, if you have two values in LabelName, xyz and xyz2 and none is selected QlikView doesn't know what value LabelName has and if you add a text object with just =LabelName it will return null. If you pick one value it will display that value though since it doesn't have to make a desicion for what value to show.

There is nothing technically wrong with the expression and technically it will work perfectly in a Text object as well as a list box but if you're experiencing results that you're not anticipating I suggest that you post an example here since that gives everyone a better view of what's going on.

Not applicable
Author

Hi,

Thanks for your reply and the vaulable inputs. You are right, LabelName has more than one value and it's causing text box to show null when I dont select anything in LabelName (thanks for pointing this out!).

Attaching a sample qvw for your reference, I wish to display the value of a field (which is dynamic) corresponding to a LabelName. Is there a way to display it in a text box without making any selections?

Thanks

Amit

Not applicable
Author

Sorry, forgot the attachment.

Anonymous
Not applicable
Author

Hi Amit,

In this case you should be able to use Maxstring() or Minstring() as you're only looking for one value but it gives you the data aggregation you need.

So, in other words:

=maxstring(if(LabelName='xyz',$(Language)))

This should work. Depends on how complex the final solution will be though.

Not applicable
Author

Thanks for the suggestion, however maxstring() works only till we are not selecting anything other than 'xyz' in LabelName.

One way I think is to create a variable in edit script and use lookup() or applymap() functions. However, this will lead to creation of as many variables as values in LabelName..that's why I wanted to do this in front-end but lookup() or applymap() does not work there. Attaching sample qvw showing use of these functions in edit script.

Thanks

Amit