Case expression wiith try for default

Hi guys, I’m sure the subject line kinda explains it. I basically like to use something like the following:

case({Hour},
11,{Hourly_PP},
19,{Hourly_PP},
3,{Hourly_PP},
try({Root Container.HourlyCount}[4,'Hourly'],0)
)

so basically if we are in those hours show the live tag value of the Hourly_PP but if we are not there, grab that specific column of the dataset which is an integer and if it doesn’t exist just use zero. I use try because there is no data for hours ahead so I like to show zero for those not NULL.
I keep getting argument 7 is not a valid type… I thought ‘try’ returns an object and case returns an object as well so why this setup doesn’t seem to work? Thanks in advance! :thumb_right:

Can you wrap the try in a toInt() function?

case({Hour}, 11,{Hourly_PP}, 19,{Hourly_PP}, 3,{Hourly_PP}, toInt(try({Root Container.HourlyCount}[4,'Hourly'],0)) )

I’ve found that if the expression interpreter doesn’t know what will be returned it throws an error. Forcing it into a datatype sometimes makes it behave.

Perfect, Thank you!!!