Class PBESetMaxAction

Object
  |
  +--PBEAction
        |
        +--PBEAttributeAction
              |
              +--PBESetMaxAction

public class PBESetMaxAction
extends PBEAttributeAction


Description:
PBESetMaxAction looks up the highest current value of this attribute in all rows of this object. This value gets increased by 1 and set to the attribute this event is declared on. PBESetMaxAction can be used in attribute events.


Event String Action Name:
setmax


Syntax:

setmax


Parameters
PBESetMaxAction does not support any parameters.


Examples:
 PBE:attributeEvent(
   "item",
   "number",
   "on:new:setmax");
 
The last event causes the attribute "number" of the object "item" to be set to the highest occuring value of the "number" attribute plus 1 before activation of the "new" method.

Practically this event leads to "number" being increased with each new record being added. However if a record gets deleted that does not have the highest value in all current records, its "number" value does not get reassigned to a new record.

Consider the following example:

   
Data records of object "item"
"name" "number" ...
First Record 1 ...
Second Record 2 ...
When adding a new record now, "setmax" looks up the highest value of "number", which in this example is 2, increases it by 1 and sets the value of the attribute "number" of the to be added set of data to that value (3).

Thus the object would look like this after adding a new record:

   
Data records of object "item"
"name" "number" ...
Fork 1 ...
Knife 2 ...
Spoon 3 ...
When deleting the first record now, the object would look like this:
   
Data records of object "item"
"name" "number" ...
Knife 2 ...
Spoon 3 ...
After adding a new entry at this point, the object would look like this:

   
Data records of object "item"
"name" "number" ...
Knife 2 ...
Spoon 3 ...
Teaspoon 4 ...
The above example can be found in the file "initdemo.pbt" of the "PBE Demo" module (approx. line 277).


Fields inherited from class PBEAction
iParameters, iType, name, procName
 
Constructor Summary
PBESetMaxAction(varchar name)
           
 
Methods inherited from class PBEAction
actionArguments, actionCall, actionParameters, attributeReference, callString, checkEvent, getObject, methodReference, nestedInput, objectReference, parameter, parameters, perform, performParameterCount, printPerform, tracePerform
 

Constructor Detail

PBESetMaxAction

public PBESetMaxAction(varchar name)