Skip to main content
Good Morning,

What is the possibility of uniface having the ternary operator?


------------------------------
Juliano Garcia
Suport Analyst
Coamo -Coop. Agropecuaria Mouraoense
Campo Mourão BR
------------------------------
Good Morning,

What is the possibility of uniface having the ternary operator?


------------------------------
Juliano Garcia
Suport Analyst
Coamo -Coop. Agropecuaria Mouraoense
Campo Mourão BR
------------------------------

Hi Juliano,

If you mean a checkbox with True/False/Null: it's a widget option...

Regards,
Gianni



------------------------------
Gianni Sandigliano
IT
------------------------------

Hi Juliano,

If you mean a checkbox with True/False/Null: it's a widget option...

Regards,
Gianni



------------------------------
Gianni Sandigliano
IT
------------------------------
Hi Gianni,

This tree state option I already know, it would be something like:

v_result =  (a = true ? 'a' : 'b' )
;v_result  "a"


------------------------------
Juliano Garcia
Suport Analyst
Coamo -Coop. Agropecuaria Mouraoense
Campo Mourão BR
------------------------------
Hi Gianni,

This tree state option I already know, it would be something like:

v_result =  (a = true ? 'a' : 'b' )
;v_result  "a"


------------------------------
Juliano Garcia
Suport Analyst
Coamo -Coop. Agropecuaria Mouraoense
Campo Mourão BR
------------------------------

Hi Juliano,

Ah...what I usually use as IIF(condition, value1, value2).

You can build a function by yourself, putting it into SYSTEM_LIBRARY:

entry iif
returns string
params
   string pCond : IN
   string pOne    : IN
   string pTwo    : IN
endparams
if (pCond = "") return("")
if ($condition(pCond) | $uppercase($rtrim($ltrim(pCond, " "), " ")) = "TRUE")
   return(pOne)
else
   return(pTwo)
endif
end

Take care to read about $condition into Uniface manuals.

I hope it could help you.

Regards,
Gianni



------------------------------
Gianni Sandigliano
IT
------------------------------

Hi Juliano,

Ah...what I usually use as IIF(condition, value1, value2).

You can build a function by yourself, putting it into SYSTEM_LIBRARY:

entry iif
returns string
params
   string pCond : IN
   string pOne    : IN
   string pTwo    : IN
endparams
if (pCond = "") return("")
if ($condition(pCond) | $uppercase($rtrim($ltrim(pCond, " "), " ")) = "TRUE")
   return(pOne)
else
   return(pTwo)
endif
end

Take care to read about $condition into Uniface manuals.

I hope it could help you.

Regards,
Gianni



------------------------------
Gianni Sandigliano
IT
------------------------------
Thank you Gianni.

------------------------------
Juliano Garcia
Suport Analyst
Coamo -Coop. Agropecuaria Mouraoense
Campo Mourão BR
------------------------------
Thank you Gianni.

------------------------------
Juliano Garcia
Suport Analyst
Coamo -Coop. Agropecuaria Mouraoense
Campo Mourão BR
------------------------------

Hi Juliano,

Happy to have helped you!

BTW...a real ternary operator would have a larger perimeter! The user defined function I've provided accept only strings while a real ternary operator would accept any data type for value1 and value2 (numbers, dates, ...).

IMHO the request for a real ternary operator remains a nice to have wish.

Gianni



------------------------------
Gianni Sandigliano
IT
------------------------------