Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

issue Count syntax - nested expression

As beginner I am little confused with nested expressions:

I have to Count Sequenzes starting from a certain record.depending on a product line.

FirstSortedValue({<Linie={31}>}jRec,mRec)         finds my correct record Number -> 1056

Count({<jRec={">1056"},Linie={31}>}jSEQN)                   finds my correct quantity of Sequenzes ........ but how can I combine both in one command. If I replace "1056" with the FirstSortedValue command I got an error.I experimented with brackets .... but no idea.

Many thanks for a hint

1 Solution

Accepted Solutions
johnw
Champion III
Champion III

A couple approaches. Hopefully I have the right syntax for both. I tend to prefer like this, but I'm not very confident it will work here:

Count({<jRec={"=jRec>FirstSortedValue({<Linie={31}>}jRec,mRec)"},Linie={31}>}jSEQN)

But I believe the below is probably a more common approach, and I'm a bit more confident in it. It's also closer to what you were saying about experimenting with brackets. The brackets are just $(=...), which is dollar sign expansion. QlikView will evaluate what's in the $(=...) before it does anything else, and what's in there is your first expression, so it should come up with your first result of 1056. Then the results are literally inserted into the rest of the expression, which turns it into your second expression, and only then is the count evaluated. Since it is by then exactly the expression that was already working, it should return the same thing.

Count({<jRec={">$(=FirstSortedValue({<Linie={31}>}jRec,mRec))"},Linie={31}>}jSEQN)

View solution in original post

2 Replies
johnw
Champion III
Champion III

A couple approaches. Hopefully I have the right syntax for both. I tend to prefer like this, but I'm not very confident it will work here:

Count({<jRec={"=jRec>FirstSortedValue({<Linie={31}>}jRec,mRec)"},Linie={31}>}jSEQN)

But I believe the below is probably a more common approach, and I'm a bit more confident in it. It's also closer to what you were saying about experimenting with brackets. The brackets are just $(=...), which is dollar sign expansion. QlikView will evaluate what's in the $(=...) before it does anything else, and what's in there is your first expression, so it should come up with your first result of 1056. Then the results are literally inserted into the rest of the expression, which turns it into your second expression, and only then is the count evaluated. Since it is by then exactly the expression that was already working, it should return the same thing.

Count({<jRec={">$(=FirstSortedValue({<Linie={31}>}jRec,mRec))"},Linie={31}>}jSEQN)

Not applicable
Author

Second one works perfect! Many thanks!