SET

From ICE Enterprises
Jump to navigation Jump to search

Set a value in the results table (or one of its objects)

<LABEL>  Result name (or path to an object's field or method)
<VALUE>  Value of parameter, field, or last argument of method

In its simplest form, this command is used to assign a <VALUE> to a result named
<LABEL> in the results table. The simple form of SET mirrors the two-argument
form of RESULTS.

If <LABEL> points to a field or method in an object, it will invoke the named
method with the argument equal to <VALUE>.  If the method has multiple
arguments it can be specified in one of two ways: (1) all arguments are part of
<LABEL> and <VALUE> is blank, or (2) the first N-1 arguments are part of <LABEL>
and the Nth argument is <VALUE>. See examples below. Note that (1) is extremely
similar to INVOKE, except that INVOKE has the ability to put the method's return
value in a result.

Evaluating Numerical Expressions:
---------------------------------
SET can evaluate simple numerical expressions prior to storing the result.
  nM> set x 1+1
  nM> res x
    L: X               = 2

Note that, other then parentheses, precedence rules are not followed, the 
expression is evaluated left to right.
  nM> set x 1+1/2
  nM> res x
    L: X               = 1
  nM> set x 1+(1/2)
  nM> res x
    D: X               = 1.5

Examples:
  1. Set a result PI to 3.14 and then view it with the RESULTS command:
        nM> SET pi 3.14
        nM> RESULTS pi
        D: PI      = 3.14

  2. Three ways to set multiple values in an object (all of these examples call
     the setXBounds(min,max) method with the arguments 1 and 2):
       a. All arguments given in method call:
            nM> plot/bg apenny
            nM> set reg.plot.setXBounds(1,2)

       b. N-1 arguments given in method call:
            nM> plot/bg apenny
            nM> set reg.plot.setXBounds(1) 2

       c. Alternative method using the INVOKE command:
            nM> plot/bg apenny
            nM> invoke ,, reg.plot.setXBounds(1,2)

     Note that (b) is rarely used in new applications since the other forms are
     more easily recognized as calls to a specific Java method. Option (b) was
     used in older versions of NeXtMidas (prior to 1.8.0) as it predated both
     (a) and (c).


Switches:
  Scope:
    /GLOBAL    - Sets the result in the GLOBAL results table
    /PARENT    - Sets the result in the PARENT result table

  Setting Results:
    /ADDROOT   - Automatically add roots of tables
    /FORCE     - Sets in a readonly table

See Also: GET, RESULTS, INVOKE