Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
curiousfellow
Specialist
Specialist

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

In Qlikview (not Qlik Sense) I created a variable containing this value:   jan.-2023

When using this variable in set analysis the error  mentioned in the subject appears.

I tried a lot of options by adding the text-function for example, or enclose the variable name with quotation marks, so I was wondering if I can use a variable with a value like this in set analysis. 

When I use the variable in a text box I get the value  jan.-2023

Labels (1)
1 Solution

Accepted Solutions
marcus_sommer

A string-value should be always enclosed with single-quotes even if there are cases in which it worked without it. This means your variable should be appropriate wrapped, like: '$(variable)' unless the quotes are already part of the content. But this will only work in this way if your expression is already evaluated before it's assigned to the variable - otherwise the variable-content would be just the expression of: maxstring(period). Of course this could be applied, too but require a syntax-change to: '$(=variable)'

Beside of this you should change your entire approach to handle date/time-fields by applying a master-calendar which contained all needed period-fields in all needed versions - means some information might be available in various ways, like: 'Jan' and 1 and 202301 and 01/2023 and whatever ... Important is that all fields which are used for any matching and/or calculating should be pure numeric without any formatting to avoid all such syntax-stuff and should contain the right values, for example your period isn't a period else a date which is formatted.

A good starting point would be: How to use - Master-Calendar and Date-Values - Qlik Community - 1495741

View solution in original post

5 Replies
marcus_sommer

The set analysis worked if you write there the string instead of the variable? If yes, use this expression with the variable-version within a table-chart without setting a label for the expression and hover on the label. Now you will see how QlikView evaluates the variable and probably it's slightly different to the fixed string-value.

curiousfellow
Specialist
Specialist
Author

It works with a string indeed.

I am afraid that I don't understand the rest of your answer. 

I have to use the variable in an expression of a table-chart ?  When I do that, the expression does not give a result, but the columheader gives the value of the variable.

the expression of my variable = maxstring(period)

period in my table seems to be the result of the expression: date(some_date, 'MMM-YYYY')

the expression that gives an error : sum({<Period= {$(variable)}>}value)

 

 

marcus_sommer

A string-value should be always enclosed with single-quotes even if there are cases in which it worked without it. This means your variable should be appropriate wrapped, like: '$(variable)' unless the quotes are already part of the content. But this will only work in this way if your expression is already evaluated before it's assigned to the variable - otherwise the variable-content would be just the expression of: maxstring(period). Of course this could be applied, too but require a syntax-change to: '$(=variable)'

Beside of this you should change your entire approach to handle date/time-fields by applying a master-calendar which contained all needed period-fields in all needed versions - means some information might be available in various ways, like: 'Jan' and 1 and 202301 and 01/2023 and whatever ... Important is that all fields which are used for any matching and/or calculating should be pure numeric without any formatting to avoid all such syntax-stuff and should contain the right values, for example your period isn't a period else a date which is formatted.

A good starting point would be: How to use - Master-Calendar and Date-Values - Qlik Community - 1495741

Sivapriya_d
Creator
Creator

Please try
=Sum({<Period={"$(vPeriod)"}>}Value)

curiousfellow
Specialist
Specialist
Author

Thank you all, in the end this worked for me :
=Sum({<Period = {'$(=$(vPeriod))'}>}Value)