I have been working on some Crystal Reports for one of our clinics but for some reason not I nor our other IT team members understand why this error is happening. So first here is the error specifically given:
A boolean is required here. Details: errorKind Error in File CPTCharges {FD775771-FD54-40B1-891A-87AFD9539789}.rpt: Error in formula CPTCodes: 'if {CPTCodes.Day} = "0" Then ' A boolean is required here. Details: errorKind
The report has a few formula fields. The one that it is specifically referring to is:
if {CPTCodes.Day} = "0" Then
if {CPTCodes.D0} = "1" Then
{CPTCodes.CPTID}
else ""
else if {CPTCodes.Day} = "3" Then
if {CPTCodes.D3} = "1" Then
{CPTCodes.CPTID}
else ""
else if {CPTCodes.Day} = "4" Then
if {CPTCodes.D4} = "1" Then
{CPTCodes.CPTID}
else ""
else if {CPTCodes.Day} = "5" Then
if {CPTCodes.D5} = "1" Then
{CPTCodes.CPTID}
else ""
else if {CPTCodes.Day} = "6" Then
if {CPTCodes.D6} = "1" Then
{CPTCodes.CPTID}
else ""
else if {CPTCodes.Day} = "FET" Then
if {CPTCodes.FET} = "1" Then
{CPTCodes.CPTID}
else "";
{CPTCodes.Day} returns either 0,3,4,5,6,FET. Each corresponding {CPTCodes.?} will either be a 1 or a 0. {CPTCodes.CPTID} is a code given from the database corresponding to a procedure that we are charging for.
All this information is being sent in correctly from the previous page. Originally I tried doing a simple switch, but since that wasnt working I tried nested if statements. That doesn't seem to be working. Things Ive tried that ive seen answers for online that hasn't worked:
The only other thing that we found is that maybe our solution isnt compiling in the correct bit format (well not really a solution...its being run directly on server as opposed to as a solution that I can push updates from....not my choice!). So when I went to check the configuration, all I see is "anyCPU". I dont see an option for x86 or x64.
I am absolutely lost as to why these aren't working!! My last resort is to create a word doc using HTML which I really dont want to do. If I am missing any information that might help in figuring out whats up, please let me know. Any help is GREATLY appreciated!! Thank you!
EDIT:
New code, tried using this piece of code to see if anything would happen, or if I would get the same error. I got the same error. Below is the code:
if {CPTCodes.Day} = "0" AND {CPTCodes.D0} = "1" Then {CPTCodes.CPTID} Else ""
Also to just test the "boolean required here" BS, I put in this code snippet and get an error when saving that "a string is required here":
if {CPTCodes.Day} = true then "true" else "false";
The basic format for an IF expression is ...
if expr_1 then (do_1;do_2) else (do_3;do_4)
for nested IFs use either ...
if expr_1 then (do_1;do_2)
else if expr_2 then (do_3;do_4)
else (do_5;do_6}
or...
if expr_1 then
(do_1;
do_2)
else (do_3;
if expr_2 then
(do_4;
do_5)
else
(do_6;
do_7)
)
You could also try:
if {CPTCodes.Day} = "0" AND {CPTCodes.D0} = "1" Then
{CPTCodes.CPTID}
else ""
As far as the boolean error goes, what is the datatype for {CPTCodes.Day}?