Continuing the discussion from Doubts about repeatable group instances:
I mentioned in the linked discussion that you can use the developer tools to look at what happens when the user saves information in the application.
I created a Document model with two fields, a Confirm and a Boolean. I then created three documents in the application as follows:
-
Document 1
I simply saved the document. I did not click on either the Confirm or the Boolean. -
Document 2
I clicked on both the Confirm and the Boolean so that both fields had a check in the checkbox. -
Document 3
I clicked on both the Confirm and the Boolean so that both fields had a check in the checkbox. Then I clicked on them again so that both fields we empty.
When you look at the developer tools (F12), Network Analysis, Reply in your browser, you will see the following data is saved:
[
{
"jsonrpc":"2.0",
"id":"PlatformDocumentListDataLoader-3",
"result":{
"fullSize":3,
"page":{
"offset":0,
"limit":3
},
"entries":[
{
"docRef":"Repeats_Test/3",
"documentModelName":"Repeats_Test",
"document":{
"root":{
"Boolean":false,
"Confirm":null
}
}
},
{
"docRef":"Repeats_Test/2",
"documentModelName":"Repeats_Test",
"document":{
"root":{
"Boolean":true,
"Confirm":true
}
}
},
{
"docRef":"Repeats_Test/1",
"documentModelName":"Repeats_Test",
"document":{
}
}
]
}
}
]
The first document has no data for the fields, the second has “Boolean”:true, “Confirm”:true and the third has “Boolean”:false, “Confirm”:null.
This means that Confirms are not specified, true or null, whereas Booleans are not specified, true or false. Importantly, this means that if an end-user does not click on a Boolean, it is not specified. This should be considered when modeling the document model and the form.
You should note that the validation language covers this difference for you. If you model a validation rule:
[Boolean] != False
This fires whenever the checkbox in the application is filled (only for the true state) and ignores the Boolean if it has not been specified.
[Boolean] == False
This fires whenever the checkbox in the application is empty. In other words the validation language always "fills the Boolean " when it tests it so that it appears that it only takes the values true or false.
The subtle differences between what you save when using a Boolean or a Confirm may, however, have consequences when integrating other products, or using more complex workspaces.
For example, when using Workflows, you can link a Boolean or a Confirm with a process gateway. When using a Boolean, you need to consider that it can be null or false. For example the expression would look like this:
#{PlaceOrderDMWF.OrderDetails.Approver.Approved == false or PlaceOrderDMWF.OrderDetails.Approver.Approved == null}
If you used a Confirm, the condition would be:
#{PlaceOrderDMWF.OrderDetails.Approver.Approved == null}