Class PBECalculatedAttribute

Object
  |
  +--PBEUnit
        |
        +--PBEAttribute
              |
              +--PBEReadOnlyAttribute
                    |
                    +--PBECalculatedAttribute

public class PBECalculatedAttribute
extends PBEReadOnlyAttribute


Description:
PBECalculatedAttribute provides functionality to calculate its value with a given string of PrimeBaseTalk commands.


Examples:
 PBE:declareAttribute(
   "PBECalculatedAttribute",
   "discount_amount",
   "PBE:objects['item']:sum('total') * object:attributes['discount']:getValue($false, 0) / 100");
 
This event declares a PBECalculatedAttribute object called "discount_amount".

("PBE:objects['item']:sum('total')" sums up the values of column "total" in all records of the "item" object.

"object:attributes['discount']:getValue($false, 0)" gets the value of the attribute "discount". If no value exists, the default value "o" will returned. "object" refers to the object to which the attribute "discount_amount" is attached to.)

This example can be found in the file "initdemo.pbt" of the "PBE Demo" module (approx. line 212).


Fields inherited from class PBEAttribute
enabled, iAfter, iBefore, iOn, iStatus, iValue, name, object, visible
 
Constructor Summary
PBECalculatedAttribute(PBEObject my_object, varchar name, varchar calc)
           
 
Method Summary
 generic getValue(boolean is_edit, generic default_value)
           
 
Methods inherited from class PBEReadOnlyAttribute
initializeValue, initializeValue, setValue
 
Methods inherited from class PBEAttribute
afterInput, beforeInput, disable, doAfterInput, doBeforeInput, doOnOutput, enable, enabled, getStatus, getValue, globalReference, hide, inputValue, onOutput, outputValue, prepareAction, setStatus, setValue, show
 
Methods inherited from class PBEUnit
compileActions, compileConditions, prepareEvent
 

Constructor Detail

PBECalculatedAttribute

public PBECalculatedAttribute(PBEObject my_object,
                              varchar name,
                              varchar calc)
Parameters:
my_object - the object this object should be attached to.
name - the name used to access this object.
calc - the calculation string containing a valid numeric expression.
Method Detail

getValue

public generic getValue(boolean is_edit,
                        generic default_value)
Overrides:
getValue in class PBEAttribute