Wednesday, August 26, 2015

String to Boolean


I needed a way to convert a string to a boolean. Specifically, I wanted to use a message in the message catalog to store a variable to allow us to easily change the flow in a specific page. This turned out to be much easier than I expected.

Using the following short hand returns a true if the string matches or false if it does not.

(&theString = "Y")

Here is how I used it with the message catalog text:
Local array of number &openMonths = CreateArray(1, 5, 9);
Local boolean &openSeason = (MsgGetText(21027, 8, "false") = "true");
...
If (&openMonths.Find(Month(&today)) > 0 And
      Day(&today) < 16) Or
      &openSeason Then
       ...
end-if;
     

No comments:

Post a Comment