fgl_charbool_to_intbool()

This function converts an Informix Universal Server BOOLEAN value ("t", "f") to a standard 4GL INTEGER value (TRUE, FALSE). The function returns NULL if the given value does not match "T", "t", "F" or "f".

When you retrieve a BOOLEAN value from the database, you can convert this value with the fgl_charbool_to_intbool().

In this example, the integer value returned fgl_charbool_to_intbool() is converted to the character value to show that NULL is returned by the function if its argument is not valid (here - if it is not a "T", a "t", a "F", or an "f"). If the argument is invalid, a string saying "_NULL_" will appear in the output message.

MAIN

DEFINE arr ARRAY[7] OF CHAR(1),

       i INTEGER,

       ch CHAR(6),

       print_str char(256)

INITIALIZE arr TO NULL

LET arr[1]="t"

LET arr[2]="T"

LET arr[3]="f"

LET arr[4]="F"

LET arr[5]="0"

LET arr[6]="A"

LET print_str="Results:"

FOR i = 1 TO 7

  LET ch = fgl_charbool_to_intbool(arr[i])        

  LET print_str = print_str clipped,"\n|  ",arr[i],"  |",nvl(ch, "_NULL_"),"|"

END FOR

CALL fgl_winmessage("fgl_charbool_to_intbool()", print_str, "info")

END MAIN

 

Contact Us

Privacy Policy

Copyright © 2024 Querix, (UK) Ltd.