compare boolean in flow service

Hello,

I have created a documentType from an XML Schema in the designer. In this XML Schema, some fields are boolean, and they have been created as a String data type, with content type boolean.
In a branch, how am I supposed to test the value of this boolean? Do I have to compare it to “1”,“true”,“0” and “false”? Is there any option to avoid those 4 comparisons to have only 2 (true/false or 1/0)?

Thanks in advance.

Nicolas

Hi,

Correct me if I am wrong.

At run time, what is the value that is expected in the field. Based on that you can do your branch logic.

Can you share me the screen shot on documentType which shows the content type for the field.

Hello,

At run time, the value can be “1”,“true”,“0” or"false". (as an XML boolean)
Please find attached a screen shot as requested.
Capture.PNG

I think value ‘1’ is considered as ‘true’ and viceversa. value ‘0’ is considered as ‘false’ and viceversa

At-least you can two combinations:

Code something like this

Branch (Evaluate labels on true)
MAP %e2%=‘true’ || %e2%=‘1’
MAP %e2%=‘false’ || %e2%=‘0’

You can also implement using re-gex but the above code should be fine.

Let me know if this looks OK.

in XML , Legal values for boolean are true, false, 1 (which indicates true), and 0 (which indicates false).
What Mahesh was saying is correct.

Yes the Branch with var substitution to check boolean case should work as true(1) /false (0)…In anycase if you see other than this could be some pipeline issue.

HTH,
RMG

Thank you all for your answers.
I came to the same conclusion, but I was hoping that maybe I could use some dedicated functions like $true or $false, or something else :slight_smile: