Need a TextToBoolean function
842
Views
9
Comments
On our RadarOn our Radar
Builtin & User functions
We have BooleanToText but no TextToBoolean . :)

J.Ja
ToLower(String) = "true" :)
Andre - I know, it's ugly, and there should be a symmetry. :)

Also, can't audit the use (if I ever need to... not likely in this case).

J.Ja
2016-04-21 20-09-55
J.
 
MVP
tricky.

how would it be solved.

is "1" true? 
is "01" true?
is "one" true?
is "waar" true?
is "not false" true?
is "valid" true?

in the end you will probaly make an action yourself anyhow.
 
If BooleanToText is going to output "True" or "False" then TextToBoolean should use those values. Nothing else in OutSystems does anything in that C-style of "true unless 0 or NULL", so I see no need for this to do it either.

The point is, BooleanToText should be reversable, and a developer should not need to inspect the documentation to be able to turn the results of BooleanToText back into a boolean. :)

J.Ja
2016-04-21 20-09-55
J.
 
MVP
Not everything should be reversable, but ok, I can live with it.

when we 're on it, it should be lowercase, so javascript understands it instantly ;)
If(String_Split.List[4].Text.Value = "True",True,False)

String_Split.List[4].Text.Value from NotifyWidgetGetMessage

I can't think of another way so this is how I get on with it. :D
You can improve that:

String_Split.List[4].Text.Value = "True"

will do the same thing. :)

J.Ja
Merged this idea with 'Service Studio - Function to convert TextToBoolean' (created on 29 Nov 2019 13:12:41 by Luis Soares)

I just noticed that we don't have a function to convert a Text to Boolean.

Example:

If(ToLower(Trim(Text))="true",True,False)

also

text = 1 => True

Text = 0 => False



This comment was:
- originally posted on idea 'Service Studio - Function to convert TextToBoolean' (created on 29 Nov 2019 by Luis Soares)
- merged to idea 'Need a TextToBoolean function' on 30 Nov 2019 18:33:08 by Justin James