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: 
brijeshvma
Partner - Creator
Partner - Creator

Use Variable in Inline Table

Hi All,

I have Inline Table  As:

Target:

Load * Inline [

%Target, TargetOrder, TDAchieved ,TDTarget

Session,1,'sum({<MonthID={$(=max(MonthID))}>}SpValueDaily)','sum({<IsCurrentMonth={1}>}SpValueDaily)'

];

and in text .. I have a Expression

1: $(=Maxstring(TDAchieved))

2: $(=Maxstring(TDTarget))

But my first Expression is not giving a Value .. Where i am calculating value for max month based on user selection.

if i am Writing my expression Directly  sum({<MonthID={$(=max(MonthID))}>}SpValueDaily)

in Text its gives me a Output.. I need how to write same thing in inline table and use as Variable..

Kindly check and help me on this. i as Well Attaching sample data and qvw for the same.

Either how can i write set analysis on script in inline table to get max month on customer selection

1 Solution

Accepted Solutions
marcus_sommer

The reason why it's not working is that you have a $-sign expansion within your first expression and they will be evaluated during the load and it results in NULL for it - if you have a look within the tableviewer on this table in preview and looked on the result from this field you will see that the expression is umcomplete and therefore couldn't be work within the gui.

One commonly used workaround for these topic is to use another char for it and replace it later, like in this example:

Target:

Load %Target, TargetOrder, replace(TDAchieved, '###', '$') as TDAchieved ,TDTarget Inline [

%Target, TargetOrder, TDAchieved ,TDTarget

Session,1,'sum({<MonthID={###(=max(MonthID))}>}SpValueDaily)','sum({<IsCurrentMonth={1}>}SpValueDaily)'

];

- Marcus

View solution in original post

5 Replies
brijeshvma
Partner - Creator
Partner - Creator
Author

Any other solution to achieve this .. Apart from this one ..Kindly help me on this.

brijeshvma
Partner - Creator
Partner - Creator
Author

Is there any Response on this ?

marcus_sommer

The reason why it's not working is that you have a $-sign expansion within your first expression and they will be evaluated during the load and it results in NULL for it - if you have a look within the tableviewer on this table in preview and looked on the result from this field you will see that the expression is umcomplete and therefore couldn't be work within the gui.

One commonly used workaround for these topic is to use another char for it and replace it later, like in this example:

Target:

Load %Target, TargetOrder, replace(TDAchieved, '###', '$') as TDAchieved ,TDTarget Inline [

%Target, TargetOrder, TDAchieved ,TDTarget

Session,1,'sum({<MonthID={###(=max(MonthID))}>}SpValueDaily)','sum({<IsCurrentMonth={1}>}SpValueDaily)'

];

- Marcus

brijeshvma
Partner - Creator
Partner - Creator
Author

Hi Marcus,

thank you so much for your reply and explanation.. its working now .....:)