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: 
umartareen
Creator II
Creator II

Variable Execution In Inline Load

Hi,

I have a scenario where I need to evaluate an expression (that is stored in a variable) in Inline Load.

It goes like this

let vGr = 'sum({<Side = {"Re"}>} Amount) - sum({<Side = {"Count Of Product"}>} Amount)';

load * Inline [

Side, Amount

Ar, $(vGr)

];

Upon taking the variable vGr in a textbox, it displays the sum amount (which is what is required). However when taken in a table box, it simply displays the expression itself as in the 'Let statement'.

Requirement - I need to show the evaluated expression of the variable in my pivot table/ Table Box.

I would really appreciate if anybody comes up with a solution for this.

Thanks,

Umar

5 Replies
sunny_talwar

May be try this:

LET vGr = 'Sum({<Side = {"Re"}>} Amount) - Sum({<Side = {"Count Of Product"}>} Amount)';

LOAD Side,

          Evaluate(Amount) as Amount       

Inline [

Side, Amount

Ar, $(vGr)

];

swuehl
MVP
MVP

I don't think you can evaluate a set expression in the script.

In general, a table box can't have expressions, so it will always show the field value.

Further more, I don't think you'll find a way to evaluate the field value as a kind of dimensional expression except using a pick(match()) combination. If you are looking for something like this, there are some examples here in the forum.

sunny_talwar

That makes sense

Sorry I remember Clever Anjos showing how Variables can be evaluated in the a Inline load. So I thought it would work. But it makes sense that since set analysis does not work in the script, it would not be evaluated as well.

Best,

Sunny

umartareen
Creator II
Creator II
Author

Hi Thank You for the comments.

I actually need to show the evaluated output in a pivot table. Also, I am able to evaluate this expression when I use the variable in a textbox, but unable to display it in a pivot table. Not sure why.

Regards,

Umar

maksim_senin
Partner - Creator III
Partner - Creator III

Hi,

It seems you mix logic which can be implemented in a load script with expression's one. They are similar in some aspects but differ in details. The variable you created with LET can be used in Pivot Table of any other chart, but in load script you should use other syntax constraction. I believe it's better to use FOR-NEXT cycle which would add record per record to your table.

Best regards,

Maxim