Hi
I am scratching my head over problem with several query tags which are bound to the bottom banner label of the starting screen. Occasionally they keep failing which makes whole banner red and tags have an error - java.lang.nullpointexception
Original code behind query tag (in properties selected as event driven ) looks like (actual names changed):
SELECT Level FROM Level_Table
i made some changes to protect from the following:
1 Null value if record is return but it is null by using Coalesce - if null then 0 value is default
2 SELECT EXISTS to protect from query failing and no rows returned - if no records than 0 value is default
When i put the code below behind the tag and try to restart it it stays red all the time
which make me feel i overcomplicated this Any thoughts how to solve this?
if(SELECT EXISTS(SELECT Level FROM Level_Table),SELECT COALESCE (Level,0) FROM Level_Table,0)
Can you help me please bit more to understand what would fallback outside query mean in my case? My query tag is being fed to the label. Sometimes during startup after licence expiry this tag becomes red with the message described above.
In my modified query i use coalesce only if select exists is successful so there must be at least valid dataset
Any thoughts?
thanks for your help again screenshot below. Just to make sure its clear - sometimes during startup both query tags and banner gets red so if I improve error handling there will still be issue with red query tags i guess?
Hi Phil
Yes you are correct -i am not sure if a row is always returned. I have just applied your solution for testing. I thought that to check if there are no rows i should use if(SELECT EXISTS(…),0) instead of coalesce but i did not get the syntax right for the last statement.
Thanks for help
i had this failure again and noticed that some query tags did not have datasource configured and failed. As silly as that
Not sure why default database connection sometimes was used and sometimes not but i need to remember not to leave datasource as blank