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: 
Not applicable

Textbox If statement / Show condition / set variable not working

The error shown in the window as follows:

Garbage after Expression ','

1  | if(vSC_DateType = 'POSTING',
2  |
if(GetSelectedCount(Posting_DayOfMonth) <> 0,vPostSelectedDay=1 and
3  |
if(GetSelectedCount(Posting_Month) <> 0, vPostSelectedMonth=1 and
4  |
if(GetSelectedCount(Posting_CalendarYear) <> 0, vPostSelectedYear=1))
5  | ),
6  |
if(vSC_DateType = 'INSERT',
7  |
if(GetSelectedCount(Insert_DayOfMonth) <> 0, vInsertSelectedDay=1) or
8  |
if(GetSelectedCount(Insert_Month) <> 0, vInsertSelectedMonth=1)  or
9  |
if(GetSelectedCount(Insert_CalendarYear) <> 0, vInsertSelectedYear=1))
10 | ),
11 | if(vSC_DateType = 'CREATE',
12 | if(GetSelectedCount(Create_DayOfMonth) <> 0, vCreateSelectedDay=1) or
13 | if(GetSelectedCount(Create_Month) <> 0, vCreateSelectedMonth=1)  or
14 | if(GetSelectedCount(Create_CalendarYear) <> 0, vCreateSelectedYear=1))
15 |
)


Error seems like its starting at line 10. The first two if statements work, adding the third doesn't compile.

Any ideas?

8 Replies
oknotsen
Master III
Master III

Seems to me you do not have the right amount of brackets in there.

If you put your cursor in front of a bracket, that bracket becomes orange and underlined and so does the related bracket. Check if the right brackets are related.

Based on a quick check I did, the last bracket is not related to the first bracket and the openings bracket seems to be related with line 10 (which makes the error "garbage after line 10" understandable.

May you live in interesting times!
Not applicable
Author

Yes you are correct, that was it. The other side effect of the logic is the variables never get set in the process

jyothish8807
Master II
Master II

Hi Walter,

Try adding one more closing  bracket   " ) " at line 10 and two at line 15.

Regards

KC

Best Regards,
KC
Anonymous
Not applicable
Author

Could you share a sample app?

oknotsen
Master III
Master III

If your question is answered, could you please flag the Correct Answer (and optionally a Helpful Answer)?

If not, please let us know what part of your question still needs answering .

May you live in interesting times!
Not applicable
Author

This fixed the issue: Although the variables did not update.

if(vSC_DateType = 'POSTING',

   if(GetSelectedCount(Posting_DayOfMonth) <> 0,vPostSelectedDay=1 or

   if(GetSelectedCount(Posting_Month) <> 0, vPostSelectedMonth=1 or

   if(GetSelectedCount(Posting_CalendarYear) <> 0, vPostSelectedYear=1))

),

if(vSC_DateType = 'INSERT',

   if(GetSelectedCount(Insert_DayOfMonth) <> 0, vInsertSelectedDay=1) or

   if(GetSelectedCount(Insert_Month) <> 0, vInsertSelectedMonth=1)  or

   if(GetSelectedCount(Insert_CalendarYear) <> 0, vInsertSelectedYear=1

),

if(vSC_DateType = 'CREATE',

   if(GetSelectedCount(Create_DayOfMonth) <> 0, vCreateSelectedDay=1) or

   if(GetSelectedCount(Create_Month) <> 0, vCreateSelectedMonth=1)  or

   if(GetSelectedCount(Create_CalendarYear) <> 0, vCreateSelectedYear=1)

)))

Not applicable
Author

I got it thanks for your reply

dineshmdane
Partner - Contributor III
Partner - Contributor III

Hi Walter,

I am also stuck with the same problem as yours.

Could you please provide the steps to solve the problem.

Regards,

Dinesh M