I have been having a rather troubling issue with utilizing Crystal Reports pulling data through a PostgreSQL ODBC source. It appears I have a boolean field that is showing up as a boolean in the database expert and pretty much everywhere in Crystal reports. I have an if statement that I am trying to use that will either not function, or error out when using it. When I browse the data, it is either a 1 or a 0, and is a string with the length of 5.
Trying to fix this has been problematic to say the least.
This one doesn’t work (always pulls the name from client rather than client_contact)
if ({client_contact.bill_to_contact} = "1") Then
trim({client_contact.given_name} + ' ' + {client_contact.initial}) + ' ' + UpperCase({client_contact.surname})
else
trim({client.given_name} + ' ' + {client.initial}) + ' ' + UpperCase({client.surname})
This one errors out saying it requires a boolean at bill_to_contact (which is a boolean).
if {client_contact.bill_to_contact} Then
trim({client_contact.given_name} + ' ' + {client_contact.initial}) + ' ' + UpperCase({client_contact.surname})
else
trim({client.given_name} + ' ' + {client.initial}) + ' ' + UpperCase({client.surname})
I tried the eqv function I have CR version 12.0.0.683.
It turns out it was an issue with the ODBC driver that I was using for the database.
It had a setting for “Booleans as Chars” that was turned on.
Fixed it, worked like a charm.
Much thanks anyhow for the type conversion tips! They will be useful down the road I am sure.