When to Use a Yes No Field
A YesNo field is used when the field in the ERP system has only two different values. This could be a bit value (0 or 1) or text values like Yes or No, True or False, OK or NOK.
These two different values could be anything. When the value comes to our framework, it will be converted to a .NET boolean. The ADM will display this as a checkbox. The checkbox could be checked or unchecked.
In the figure below a bit field in SQL Server could be used as a YesNo field. In SQL Server a bit field could be either 0 or 1.
Configure a Checkbox
In this section you will learn how to configure a checkbox. First you will get information about the object field settings. The second part describes the view field settings.
Object Field
If you create a new YesNo object field or method field, it is possible to change some type specific properties. Of course there are also a lot of generic properties like unique, external name or default value. Refer to common properties for more information about this topic.
- Click on the object.
- Create a new field.
- Change the type from Text to YesNo.
True and False Value
A YesNo field is represented by a .NET boolean. This means that our framework will try to convert the data to a .NET boolean. Some interfaces like the SAP interface can do this automatically. Some interfaces do not support type casting and have to rely on the input and output settings. When the framework could not cast the data to a valid .NET boolean you will get an error.
When it comes to the input settings there is a True Value property and a False Value property. A true value corresponds to a checked checkbox. The value configured in these properties will be sent to the external system if the interface does not support casting to the .NET type.
When it comes to the output settings there is a True Value property and a False Value property. When data is retrieved via the interface and the interface does not support casting to the .NET type, the output settings are used to convert the value to a boolean .NET type.
View Field
The YesNo view field is displayed in the ADM by a checkbox. In the following image you see a multi record view with a create view. Product Active is a YesNo field and is represented by a checkbox.