Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
gmenoutis
Partner - Creator II
Partner - Creator II

Row level $ evaluation

It seems to me that whenever a dollar sign evaluation changes as string (not as underlying values) per row, this always fails.

Consider the following simple .qvf. Script:

T:
LOAD *,'A ' & operator & ' B' as formula;
LOAD * Inline[
A,B,operator
5,2,*
3,4,+
];

 

As you can see, [formula] provides a perfectly correct string for evaluation. Sure enough, if I copy-paste the exported values into the formula ediotr, it works for each seperate line/ However, using a measure $(=formula) returns nothing.

Is this behaviour documented? Is the engine indeed incapable of using different-per-row-formula dollar sign evaluation? Is there any way to implement this differently in cases where it's needed?

5 Replies
tresesco
MVP
MVP

Yes, it's known that $ expansion happens outside chart context. Alternatively, if script solution is an option you could try using evaluate(), like:

 

Evaluate(A&operator&B)  as  result

gmenoutis
Partner - Creator II
Partner - Creator II
Author

LOAD *, evaluate(formula) as eval;
LOAD *,'A ' & operator & ' B' as formula;

 

Tried it, doesn't work.

It seems to me that evaluate it just script syntax version of the exact same functionality.

tresesco
MVP
MVP

While concatenating you are making a mistake, try like:

 

LOAD *, evaluate(formula) as eval;
LOAD *, A  & operator &  B as formula;                    // without quotes around fields

gmenoutis
Partner - Creator II
Partner - Creator II
Author

But evaluate will still not work if the string contains a fieldname, correct?

I'm just trying to get an answer while avoiding posting a very complicated example.

tresesco
MVP
MVP

Did you try with the way I suggested? Didn't it work with sample you shared? It worked with me. 

 


@gmenoutis wrote:

But evaluate will still not work if the string contains a fieldname, correct?

I'm just trying to get an answer while avoiding posting a very complicated example.


Evaluate WILL work because you are not concatenating the field names (when you remove quotes) but field values. If your actual scenario is more complicated, without a sample or explanation - for sure we would not guess it correct. Just give a try...