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

garbage after if error!

Hello,

I've written the lines below in the Text Color section of my Straight Table:

if ( FieldValue('OS1', 1) > 750 and RowNo() = 1)

if( FieldValue('OS1', 14) = 70983.10938 , lightred())


My problem is that it keeps giving me the error " Garbage after "if" ". Is there a way to seperate 2 lines in QLikView? I tried adding ( ; ) to the end of the first line but it didn't work.

What should I do?

Thanks,

Naeemeh

1 Solution

Accepted Solutions
Not applicable
Author

Hi

You can't separate two lines in an expression, you need to write an IF....THEN....ELSE group of statements like:

IF ( SUM ( OS1 ) > 750 AND RowNo() = 1 , LightRed() , IF ( SUM ( OS1 ) > 65000 AND RowNo() = 14 , LightRed() , Black() ) );

Note: I put the black in at the end so you have a colour if it doesn't match either of the conditions, change this colour to what you want.

Cheers,

View solution in original post

5 Replies
Not applicable
Author

These are the correct lines:

if( FieldValue('OS1', 1) > 750 and RowNo() = 1 , lightred())

if( FieldValue('OS1', 14) = 70983.10938 , lightred())
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Don't use the FieldValue() function in this context.

OS1 will be evaluated using the row dimensions.

if (sum(OS1) > 750 and RowNo() = 1, lightred())

-Rob

Not applicable
Author

Hi Rob,

Thanks for the hint, it solved another problem that I had 😄 but I still get the original error that I posted here. What I write is:

if ( sum(OS1) > 750 and RowNo() = 1, lightred() ) ;

if ( sum(OS1) > 65000 and RowNo() = 14, lightred() ) ;

And I get "Garbage after expression ";" " error. Is there any way that I can separate 2 lines?

Thanks,

Naeemeh

Not applicable
Author

Hi

You can't separate two lines in an expression, you need to write an IF....THEN....ELSE group of statements like:

IF ( SUM ( OS1 ) > 750 AND RowNo() = 1 , LightRed() , IF ( SUM ( OS1 ) > 65000 AND RowNo() = 14 , LightRed() , Black() ) );

Note: I put the black in at the end so you have a colour if it doesn't match either of the conditions, change this colour to what you want.

Cheers,

Not applicable
Author

Thank you so much 😄 it workedYes