Applicable Versions: 2.01.0152 onwards


If your query returns a field with a boolean (logical) data type, it will be displayed using the default Microsoft format, that is 0 for false and -1 for true in a report. There are two ways you can overcome this behaviour to display either true or false (or any other two strings you want.


Resolution 1
The first is to use scripting in the report designer. The video below shows how to add scripting to a report to reformat the boolean field. The script used in this example is available below:




Sub OnBeforePrint
  
If Rpt.Sections.item("Detail").Controls.item("Field2") = 0 Then
    Rpt.Sections.item("Detail").Controls.item("Field2").Text = "False"
  Else
    Rpt.Sections.item("Detail").Controls.item("Field2").Text = "True"
  End If
End
 Sub


Resolution 2
The second way to solve it is to create a 4GL calculated field in your subject (rather than in the report designer), that is a string with the value True or False. The video below shows how to use a calculated in the subject to reformat the boolean field. The expression used in the calculated field in this example is available below:




string(sports2000.Family.CoveredOnBenefits,""True/False"")