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: 
chrisg
Partner - Creator III
Partner - Creator III

Declare Variable with SET Statment

Hi,

i would like to declare a var. with the SET Statment

SET VAR == SUM({$<MONTH = {"<=$(=max(MONTH))"},KONTO={'Umsatz'}>} Periode)

But i do have the problem that i get for the Part "<=$(=max(MONTH))" a {"<=(internal error)"}


Any hinds

many thx


Chris


Do or Do Not. There is no try!
7 Replies
Not applicable

With SET you are setting a string value. With LET you are calculating what is behind the equals sign. So most likely all you have to do is change an S for an L and you're fine to go 🙂

chrisg
Partner - Creator III
Partner - Creator III
Author

Hi

many thx - but i am afraid this does not wok for me:-(

FIRST:

Aggregation expressions not allowed in GROUP BY clause


LET Var = sum({$<Month = {"<=(internal error)"},KONTO={'Umsatze}>} Periode)

and the "<=(internal error)" is still there Sad

Chris

Do or Do Not. There is no try!
tresesco
MVP
MVP

Hi,

it seems that you are working at script level. Set Analysis can't be used in script. it is used to play with Selection in front end.

regards, tresesco

chrisg
Partner - Creator III
Partner - Creator III
Author

Hi Tresesco, many thx - i do have a lot of very long formulars in my document. the idea was to work with vars. I try to declare a var over the menue (Varlist) - that worked without a problem!? But i do not want to use the editor for that. thx Chris
Do or Do Not. There is no try!
tresesco
MVP
MVP

So the problem is that, Max(MONTH) is not working. right? Can you test this part in the text object, and check what the output is coming?

chrisg
Partner - Creator III
Partner - Creator III
Author

Hi,

that works! - pls see my picture

Chris

Do or Do Not. There is no try!
Not applicable

Hello Chris, (hi tresesco),

in my oppinion the $()-expansion is the thing you are struggling with. This feature can be used in expressions, but also in the script. And your problem is that this replacement is done automatically when the "$(=" appears (somewhere) in the script code. But in your special case QV should do no expansion.

With this in mind I searched for a workaround e.g. using [ ] and ' ', but in vain. The only raw Idea is this:

SET DOLLAR= '$(=';

SET VAR == SUM({$<MONTH = {"<= $(DOLLAR) =max(MONTH))"},KONTO={'Umsatz'}>} Periode);


Yes, It looks a bit strange. Without 'Umsatz' another solution would be using LET and stringconcat like LET VAR = '... ' & '$' & '......';

Regards, Roland