Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
New Contributor III

Expansion with SubField creating error in If Statement

My If statement feels like it should be pretty simple, but my second SubField expansion is breaking the expression, and I'm assuming this is because I'm using $(=) instead of $(), but I'm not sure how else to pull in the expansion. 

//Any Selections for Right Axis
//More than Two Selections for Left
//Anything Else​


Essentially this code is for the expression portion of a list box.  There are right and left list boxes.  The list boxes changes based on user selections.  They select a field they want to analyze and then they can choose a "Left" expression(s) and/or a "Right" expression(s).  The ExprL table has expression names in one field and dollar sign expansions in another.  These expansions correlate with expressions I already have stored as variables.  So when the user selects "Sum of Premium" this would link to $(vSumPremium), which is what I would want to use as the expression.

This works fine except when only one value is selected for the ExprL.Favorites, this means only one value for ExprL.Expansion is available, so evaluating for SubField number 2 creates an error in my expression.  It shows up as "-" in the list box, and when thrown into a text box returns "Error: Error in expression: ')' expected".  

I solved this by choosing the '2' in the second SubField to '-1', but would there be a way to get this to work while still pulling the second SubField?  Picture Below


Broken List Box.PNG


Labels (1)
1 Reply

Re: Expansion with SubField creating error in If Statement


I'd suggest you to share an example app. 

Another thing is to try to evaluate the expressions in text boxes separately: eg


for one 



for another.

It might help you to understand what exactly is happening, when you make your selections