I have the below IFF statement meant to control the width of the Soil Description column in my boring log.
<<IIf(<<HasData(<<UVOST_SCREENING2.SIGNATURE TYPE>>)>> AND <<HasData(<<PID_SCREENING.Concentration>>)>> AND <<HasData(<<WELL_DETAILS.Well_ID>>)>> ,2.5,_<<IIf(<<HasData(<<UVOST_SCREENING2.SIGNATURE TYPE>>)>> AND <<HasData(<<PID_SCREENING.Concentration>>)>> AND NOT <<HasData(<<WELL_DETAILS.Well_ID>>)>>,3.65,_<<IIf(<<HasData(<<WELL_DETAILS.Well_ID>>)>> AND <<HasData(<<PID_SCREENING.Concentration>>)>> AND NOT <<HasData(<<UVOST_SCREENING2.SIGNATURE TYPE>>)>>, 2.8,_<<IIf(<<HasData(<<UVOST_SCREENING2.SIGNATURE TYPE>>)>> AND <<HasData(<<WELL_DETAILS.Well_ID>>)>> AND NOT <<HasData(<<PID_SCREENING.Concentration>>)>>,2.8,_<<IIf(<<HasData(<<PID_SCREENING.Concentration>>)>> AND NOT <<HasData(<<UVOST_SCREENING2.SIGNATURE TYPE>>)>> AND NOT <<HasData(<<WELL_DETAILS.Well_ID>>)>>,3.95,_<<IIf(<<HasData(<<WELL_DETAILS.Well_ID>>)>> And (Not <<HasData(<<PID_SCREENING.Concentration>>)>>) And (Not <<HasData(<<UVOST_SCREENING2.SIGNATURE TYPE>>)>>),3.1,_<<IIf(<<HasData(<<UVOST_SCREENING2.SIGNATURE TYPE>>)>> AND NOT <<HasData(<<PID_SCREENING.Concentration>>)>> AND NOT <<HasData(<<WELL_DETAILS.Well_ID>>)>>,3.95,_4.25)>>)>>)>>)>>)>>)>>)>>
Each line of the statement work perfectly except for the 6th line that specifies that the width should be 3.1 if Well Details has data but not PID Screening or UVOST signature. Instead it outputs the 4.25 width, which is specifying that none of the conditions are met (there is no data in well ID, PID, and UVOST) and displays the Well construction information causing an overlap. All the other lines that specify similar conditions work correctly and cause my boring log to output the correctly specified column width and no overlap. As far as I can tell the 6th line is not formatted differently than any other line. I know that this is not location specific because all locations that meet the column width criteria are similarly impacted. Any Ideas why this specific line of my statement is not working?
As a point of reference, the Switch function is a much better way of performing this than nested IIf statements.
That being said I note an extra set of parenthesis in the if statement in question that might be causing issues (might not too). To debug issues like this I usually create an extra text entity or text vs depth column on the log and then test the statements one at a time, you can also include outputting each individual clause of the condition to see what it evaluates to such as
<<IIf([condition 1 AND condition 2 AND Condition 3],[output if true],[output if false])>> first condition = <<HasData([field])>>, second condition = <<Calc(NOT <<HasData([field])>>)>>, third condition = <<Calc(NOT <<HasData([field])>>)>>
This can help you trace logic errors in multiple and/or conditions.