How to use True / False fields in report templates - checkboxes, custom text

Below is information and reference to existing sample summary and detailed report templates and different ways to be able to display the checkmark or not in a checkbox in a report template in AyaNova v3

If using a Summary Report Template dir=ltr " ">

From the Service navigation pane Service Workorders grid, select to display the Service Workorders Invoiced sample report template.

A workorder that has Service Completed check-marked, will display so on this report.

To identify how this is accomplished in a summary report template such as the Service Workorders Invoiced report, open that sample report template in the report designer.

Drop down the Print, hold the SHIFT key and select the report template Service Workorders Invoiced

On the Design Panel, select the field xrCheckServiceComplete

Select the Properties tab on the left

Expand the DataBindings Property

Expand the CheckState property

The CheckState Binding is to the Service Completed data field.

If using a Detailed Report Template dir=ltr " ">

From the Service navigation pane Service Workorders grid, select to display the Dispatching Report - Scheduled Users & Tasks

You will note that if a part has been selected in the workorder item, and has been check-marked that it was already used in service, the report will also display this.

To identify how this is accomplished in a detailed report template such as the Dispatching Report - Scheduled Users & Tasks report, open that sample report template in the report designer.

Drop down the Print, hold the SHIFT key and select the report template Dispatching Report - Scheduled Users & Tasks

Select the Properties tab

Drop down and select xrUsed which is the name given to the checkbox in this report template.

You will see that on the Design Panel that the checkbox is identified as the field property being looked at.

Expand the Scripts property

Select to open the script editor for the OnBefore Print

This script is used to display a checkmark or not depending on the value of the Used field in that workorder item’s part selection.

If have created a customfield set for data type of True/False, and you want to show a checkbox on a report for this custom field here is an example of using a script to display either checked or not with a workorder item custom0 field of data typeTrue/False

Sample Report Using Custom True False Field

Because the Custom0 field is from the WorkorderItem section of a workorder, - a band for the WorkorderItem was made, and than fields that will be relating to the workorder item section of the workorder are placed there

I added two new fields dragged from the Toolbox into the WorkorderItem band detail area because I will be referring to workorder item data fields

The field xrLabel2 - if you take a look at the OnBeforeScript property - has a script so that you can see what the actual value of the field is dir=ltr " ">

private void OnBeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
{
xrLabel2.Text = Convert.ToString(DetailReport.GetCurrentColumnValue(“LT_WorkorderItem_Label_Custom0”));
}

The field xrCheckBox2 (has Text property edited to AntiVirus) if you take a look at its OnBeforeScript property, uses a script to set the value of the CheckBox to true (a checkmark) if the string of the field is True - otherwise it leaves it as false if it is Null or False ) because a custom field set to True/False could be True, could be False or could be Null (null if hasn’t been set either False or True yet) dir=ltr " ">

private void OnBeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
{
//this script obtains what the value is of the custom field object
//converts it to a string
//if the string value is “True” than the checkbox gets checked, otherwise it does not get checked

if ((DetailReport.GetCurrentColumnValue(“LT_WorkorderItem_Label_Custom0”)).ToString() == “True”)
{
xrCheckBox2.Checked = true;
}
else
{
xrCheckBox2.Checked = false;
}
}

Here is another suggested script to use if are using custom True/False fields and want True to display not as a checkmark, not as the text True, but instead as the text Yes.

Below example script is from the OnBeforePrint script property for the DetailReportItem band (the Workorder Item band) of a Detailed report template from the Service Workorders grid; and the field in the detail section of this band is xrLabel17, and the datafield in question is the Custom3 field.

Of course if your detail band is called something other than DetailReportItem, than you would need to edit that in this script, as you would have to edit if your field is called something other than xrLabel17, or if your custom field is other than Custom3 dir=ltr " ">

private void OnBeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
{
//this script obtains what the value is of the custom field object
//converts it to a string
//if the string value is “True” than the field gets the text “Yes” shown
//otherwise the field will show the text “No”

if ((DetailReportItem.GetCurrentColumnValue(“LT_WorkorderItem_Label_Custom3”)).ToString() == “True”)
{
xrLabel17.Text = “Yes”;
}
else
{
xrLabel17.Text = “No”;
}
}