Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
cbushey1
Creator III
Creator III

Load variables from file that contain variables

Hello there,

I already use the method outlined here by Barry Harmsen:

http://www.qlikfix.com/2011/09/21/storing-variables-outside-of-qlikview/

However, I have run into an issue where I have a need for a variable to be loaded based on the value of another variable. Let me explain what I mean.

Lets assume I have these two variables:

vMedClaim = 1;

vDrillNo = IF($(vMedClaim) = 1, '<250',250);

What I want to occur, during the script refresh, is for vDrillNo to either be '<250' or 250 as determined by the vMedClaim variable. However when I follow the method outlined in Barry's blog, the full expression is stored as the value of vDrillNo even though I am using the LET command.

Thoughts?

28 Replies
sunny_talwar

Seems to be working for me if I set the button action to set the value to '<250' or '250'... check attached

cbushey1
Creator III
Creator III
Author

I see the difference.

I used your first solution, of adding the "=" to the excel sheet, but I actually need to have the "=" as part of the set analysis as your second solution proposed.

Thanks again for the help, I think it's working now.

cbushey1
Creator III
Creator III
Author

stalwar1,

So I thought I had put this to bed, but I found a scenario where your suggestion doesnt seem to work.

Here is what we have thus far:

variable

IF($(vMedClaims) = 1,'<250','250')

Expression

=Sum({<Event_ServiceCat = {"$(=$(vDrilldownSvcCat))"}>}Dollars)


The statement above for variable is the default value, but then the user can click some buttons in the application that will change the value of this variable. When they click a button that assigns a string to the variable then the expression doesnt evaluate.


In my scenario I am looking at a string of text values (if it matters). Is there a way to modify the expression so that it will 1. still evaluate the default value (which is the IF statement) and 2. Evaluate a string of values in the set analysis?


Much appreciated.

sunny_talwar

May be share the updated sample to check this

MarcoWedel

cbushey1
Creator III
Creator III
Author

stalwar1

Sure.

variable

vDrilldownCat = IF($(vMedClaims) = 1,'String 1','String 2')

Expression

=Sum({<Event_ServiceCat = {"$(=$(vDrilldownCat))"}>}Dollars)


this works fine as long as the value of vDrilldownSvcCat is only a single value. What I have above is the default assignment of the variable but the user can click a button that changes the value of vDrilldownCat. Most of the time the button (4 in total) will assign a single value to this variable, however there is one instance where I need to assign a string of variables ('String 3', 'String 4', 'String 5') when the button is clicked.


Thoughts?

sunny_talwar

I don't see any attachment? I get what you are trying to do, but I am not exactly sure how you are doing it.. can you attach the updated file?

cbushey1
Creator III
Creator III
Author

stalwar1‌,

Here is a new sample.

The formula you gave works here until you need to evaluate a string of values. You can see what I mean by clicking the Multiple values button.

Please let me know your thoughts.

Chase

sunny_talwar

This may not be perfect, but set the multiple value like this

Chr(39) & 'GM' & Chr(39) & ',' & Chr(39) & 'Derm' & Chr(39) & ',' & Chr(39) & 'SH' & Chr(39) & ',' & Chr(39) & 'BH' & Chr(39) & ',' & Chr(39) & 'MR' & Chr(39) & ',' & Chr(39) & 'Dis' & Chr(39)


Capture.PNG

This is forcing the double dollar sign expansion to kick in.