Uniface Underground -> Undocumented.Features.Only. Go Home

condition

The "official" features are described in the proc manual. This document contains only undocumented features
 
Name condition
Return the result of evaluating a conditional expression.
Synopsis condition(Expression[,list])
Use Allowed in form, service, and report components.
Description You can use a second (and optional) parameter a associative list (id=value) that condition should use to evaluate the expression as variables and values.

Tested in 7.2.03
 

Example amount = 1500
limits = "MIN=$number(1000);MAX=$number(2000)"        ; limits of amout in a list
exp = "amount > MIN & amount < MAX" ; exp is a string with the expression
if (condition(exp, limits))
   message "The amount is correct"
else
   message "Not between limits"
endif
Note The evaluation of condition is done using (by default) string types and this can have some problems :
limits = "MIN=1000;MAX=2000"
$1 = condition("20 < MIN",limits)

In this case $1 is FALSE (0), because the condition evaluates the string "20" less than the string "1000" (ASCII values).

In order to solve this you must assing the type to the value of the items as :

limits = "MIN=$number(1000);MAX=$number(2000)"
$1 = condition("20 < MIN",limits)

This works fine!!!

The $typed fuctions are :

  • $string(value)
  • $syntax(value)
  • $number(value)
  • $float(value)
  • $boolean(value)
  • $date(value)
  • $datim(value)
  • $time(value)
  • $clock(value)

Copyright © 1999-2000  $UUU  All rights reserved.
Disclaimer. | Site Comments.