Report key calculation on boolean

I’m having trouble with a key calculation in a table on a boolean value. I’m trying to replace the simple true/false word that comes into the simple table cell from the database query with just an “ON” for true and blank for false. I assumed the proper key calculation was something like:

@EndOfCycle== true ?"ON":""@

But nothing shows up in the cells that have the boolean as true for that cell. I tried comparing to 1, but then all the cells say “ON” regardless of the true/false status of the data from the database.

FYI, I pasted the query into the Database Query Browser, and that column is showing up as a checkbox, so I’m pretty sure it’s coming across as a true boolean datatype.

Any thoughts?

Maybe creating a string expression tag to convert the bool value to “ON” and pointing your table to this tag would solve your issue.

I think something like this should work

@EndOfCycle==1?"ON":""@

EDIT:
Just tested, it works here.

I just tried again, and it isn’t working for me. What data source are you using? Maybe that has something to do with it. Mine is a postgresql table.

This is what I’m seeing. With just @EndOfCycle@ :

With @EndOfCycle==1?"ON":""@ :

With @EndOfCycle==true?"ON":""@ :

Try:

@EndOfCycle?"ON":""@
1 Like
@EndofCycle?"ON:""@

Looks like that’s working. The weird thing is, according to the docs I was reading, it shouldn’t work like that. Just the ? without a conditional should be testing for null/not-null.


^That’s from this page.

I guess it behaves differently for boolean values. Never thought to try it. Thanks for pointing me in the right direction. :slight_smile:

I was just mentally applying python rules for casting to boolean.

I tried the python way aswell without any luck