Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I have a table(switch) with single column(status) and it has value either 'true' or 'false'.
I want my script to loaded if the value is only 'true' and to be not loaded if the value is 'false'.
I wrote this in the editor:
LOAD status;
[switch]:
SELECT status
FROM [schema].[switch];
let vButton = fieldvalue(status, 1) ;
if (vButton='true') then
------ Load scripts-------
else
EXIT Script;
End If;
But this does not work. Anytime i load, it automatically exits script.
Could you please help me on this issue?
Regards,
Tommy,
Yes:)
There are two things
1) Fieldvalue function always takes fieldname parameter with single quotes. Hence below is the one change require
fieldvalue('status', 1)
2) Ideally vButton= 'true' condition should work but wrapping variable within single quotes using $ expansion always works when comparing texts. So for safer side you can always use variable like '$(vButton)' when you need to compare texts. If you want to compare numeric then no need to use single quotes, you can refer the variable like $(vButton)
Hope this is helpful
Pretty helps, thank you.
Regards,
This was exactly what I needed to solve a problem I had trying to get my script to load conditionally, thanks. Side note, this worked in QlikView also.