Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
dclark0699
Creator
Creator

Plain Text Evaluation In IF Statement

Is it possible to get a listbox to only show records where the text in a field evaluates to true? So in the example, 2 lines in the listbox, "Show" and "Show Again"

TEST:

LOAD * INLINE [

    F1, F2

    Show, 1=1

    Hide, 1=2

    Show Again, 1 < 5

    Hide Again, 1 > 5

];

I'm trying to use something like $(=F2), but it only seems to evaluate once per listbox instead of once per row

4 Replies
Gysbert_Wassenaar

The easy way out is doing the evaluation in the script:

TEST:

LOAD *, Evaluate(F2) as F3 INLINE [

    F1, F2

    Show, 1=1

    Hide, 1=2

    Show Again, 1 < 5

    Hide Again, 1 > 5

];


talk is cheap, supply exceeds demand
datanibbler
Champion
Champion

Hi Donnie,

why so complicated?

Just create an additional field in your script, a binary one (with 1 and -1 as values so you can switch between them easily) and then make a selection on that field - that will quite naturally influence the values you see in your listbox (if the two are linked which is why that field must be in the same table).

HTH

Best regards,

DataNibbler

P,S.: If you want to have that "decision" external, you can use an Excel_file with just one field and make a variable out of that which corresponds to an artificial field in your table and thus governs the decision whether or not certain records are shown or even kept in your table - you can throw them out depending on the value in that Excel_file.

dclark0699
Creator
Creator
Author

I should have been more literal in my example. I didn't think about people trying to accomplish it with the load script

The real-world use case would be having the names of variables in column F2 like the attached example

dclark0699
Creator
Creator
Author

See my below reply to DataNibbler, I wasn't thinking about the load script when I made my example. But the real use case would be evaluating the text of a variable which would be named in column F2. I attached a sample below