Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
alexis
Partner - Specialist
Partner - Specialist

Set Analysis using variable leads to "Error in set modifier"

I have a "TableX" which contains (among others) the fields:

- XPeriod which contains values such as '2013-11', '2013-10' etc

- XRecNo this field always contains "1" and I use it for more efficient record counting (better and faster than COUNT())

I also have a Calendar in the application but its not linked to "TableX".

The calendar has all the typical Year, Month, Day components.

When the user makes a Year/Month selection, I have defined a variable called "eSelectedPeriod" which I have defined as:

  Year & '-' & num(Month)

... so when the user makes a year/month selection, "eSelectedPeriod" contains the correct value (e.g. 2013-11)

My requirement is simple. I want to return the sum of XRecNo where XPeriod = eSelectionPeriod

= sum({$<[XPeriod] = {'$(eSelectedPeriod)'}>}XRecNo)

does not work - brings up the error:

"Error in set modifier ad hoc element list: '.' or ')' expected

If I create a test variable (say vTestPeriod) that contains a value (say) '2013-11'

then:

= sum({$<[XPeriod] = {'$(vTestPeriod)'}>}XRecNo)

= sum({$<[XPeriod] = {"$(vTestPeriod)"}>}XRecNo)

both work fine

Can someone explain to what I need to do differently in the case where a variable has to be evaluated?

Thanks in advance

Alexis

1 Solution

Accepted Solutions
Jason_Michaelides
Luminary Alumni
Luminary Alumni

Try adding an equals sign to your variable:

=Year & '-' & Num(Month)

Can you post your app?

View solution in original post

3 Replies
Jason_Michaelides
Luminary Alumni
Luminary Alumni

Try adding an equals sign to your variable:

=Year & '-' & Num(Month)

Can you post your app?

tresesco
MVP
MVP

I guess, while you are defining your variable in the variable overview window, you are missing '=' sing. Put an '=' before your definition expression of the variable and try.

alexis
Partner - Specialist
Partner - Specialist
Author

Well done Jason (and treseco)

Putting an equal sign solved the problem - I knew it would be simple - this was driving me insane.

Both variants of:

= sum({$<[XPeriod] = {'$(eSelectedPeriod)'}>} XRecNo)          // without equal sign

= sum({$<[XPeriod] = {'$(=eSelectedPeriod)'}>} XRecNo)     // with an equal sign

see to work fine.

Thanks again

Alexis