Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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,
These are the correct lines: if( FieldValue('OS1', 1) > 750 and RowNo() = 1 , lightred()) |
if( FieldValue('OS1', 14) = 70983.10938 , lightred()) |
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
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
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,
Thank you so much 😄 it worked