getUnitCode macro

Use this macro to get the unit code of a Property the UserArea. This only applies to Properties of type QuantityType

string getUnitCode(long property.node)
Argument Description
Property Node The node of a previously retrieved property. Note that if the given node is not a property, or of a type for which the unit code attribute is not applicable, the result is unpredictable.

Return value: The unit code of the given property.

Example:

long    contract
long    property.node
long    ret
string  unit.code(10)
property.node = getNamedProperty("contract")
if property.node <> 0 then
    contract = lval(getPropertyValue(property.node))
    unit.code = getUnitCode(property.node)
    |* Update salary record
    select  txppl001.*
    from    txppl001 for update
    where   txppl001.emno = :bpmdm001.emno
    as set with 1 rows
    selectdo
        ret = dal.change.object("txppl001")
        dal.set.field("txppl001.cont", contract)
        dal.set.field("txppl001.unit", unit.code)
        ret = dal.save.object("txppl001")
        if ret <> 0 then
            dal.set.error.message(sprintf$(
             "@Cannot update contract for employee %s; error %d",
             bpmdm001.emno, ret))
            return(DALHOOKERROR)
        endif
    endselect
endif