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

Error: Garbage after expression: ')'

Hi

I am adding a trigger to a field in document properties using the following if statement

=If(GetFieldSelections([Analytical Type])='Timeliness',1,
If(GetFieldSelections([Analytical Type])='Accuracy',2,
If(GetFieldSelections([Analytical Type])='Completeness',3,
If(GetFieldSelections([Analytical Type])='Validity',4,
0))))

However I keep getting the error above.

Any ideas what wrong?

7 Replies
sunny_talwar

Don't see anything wrong, but you can try with this

=Match(GetFieldSelections([Analytical Type]), 'Timeliness', 'Accuracy', 'Completeness', 'Validity')

vishsaggi
Champion III
Champion III

Are there any hidden brackets before adding your IF script just click Ctrl+A and delete. Then add the IF statements. Just in case..

ziadm
Specialist
Specialist

remove the = sign infront of the expression  

If(GetFieldSelections([Analytical Type])='Timeliness',1,
If(GetFieldSelections([Analytical Type])='Accuracy',2,
If(GetFieldSelections([Analytical Type])='Completeness',3,
If(GetFieldSelections([Analytical Type])='Validity',4,
0))))

vishsaggi
Champion III
Champion III

Hello Ziad,

i wonder why = sign would effect here?

andrei_delta
Partner - Creator III
Partner - Creator III

Hello,

I came across this problem recently...you can put the GetFieldSelections([Analytical Type] in a variable and then use your expression like this:

If($(YourVar)='Timeliness',1,

     If($(YourVar)='Accuracy',2,

          If($(YourVar)='Completeness',3,

               If($(YourVar)='Validity',4,

                    0)

             )

     )

)

Hope it helps,

Andrei

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Maybe replace the second equal sign by a comma?

sunny_talwar

Fixed