Method | Parameter | Return value | Comment |
---|---|---|---|
computeSqlValueRange(dt_name) | dt_name: String (SQL Alias which PLANTA uses for selecting the current record) | The return value of this function is used as a subselect in the original select for this table. So when ever PLANTA selects the current record it embeds the return value of this function to it's initial select as a subquery. Since PLANTA uses aliases as table names, the function receives the currently used table alias as input parameter | User defined method is called before the selection process for the current table takes place. |
computeOutput(di) | di: Dataitem | processed new value of the same type as the DI's type | User defined method is called for output value computation. If the DI is of string type and length of compute value exceeds DB length of respective DI, the computed value will be trimmed to fit in. |
checkInput(di, oldValue) | di: Dataitem (current DI) oldValue:same type as the DI's type (old value of DI) |
boolean value that says if check was successful | User defined method checks the validity of entered value. |
processInput(di, oldValue) | di: Dataitem (current DI) oldValue:same type as the DI's type (old value of DI)
|
processed new value of the same type as the DI's type | User defined method is called during setting of the new value and allow to perform some other action than only simple assigning of the value. Note: When an incarnation DI has a processInput() value range on both sub-DIs only the processInput() of the sub-DI with function "ID" is executed when inserting something in this field. |
deps
which contains a tuple of DI source data references. PLANTA then can assure that all references are available when ever this DI is calculated.
deps
= ('',)
deps
= ('DI012345',)
import random def computeOutput(di): list = ppms.uvar_get('@M6') return random.choice(list) computeOutput.deps = ('@M6',)
def checkInput(di, oldvalue): rec = di.get_dtp_record() compl_in_perc=rec.compl_in.get_value() #DI040154 compl_on=rec.compl_on.get_value() #DI040155 compl_by=rec.compl_by.get_value() #DI040156 if oldvalue == 0: if compl_in_perc > 99 and compl_on > 0 and compl_by != "": return True else: return False else: return True checkInput.deps = ('DI040154','DI040156','DI040155')
def computeOutput(di): rec = di.get_dtp_record() panel_title = rec.get_di_by_id(57816).get_value() mod_title = rec.get_di_by_id(1588).get_value() if panel_title == None or panel_title == '': return str(mod_title) else: return str(panel_title) computeOutput.deps = ('DI057816','DI001588')
def processInput(di, oldvalue): dtpRec = di.get_dtp_record() diVal = di.get_value() name = dtpRec.name.get_value() #DI001589 dt_id = dtpRec.dt_title.get_value() #DI003389 if name == "": dtpRec.name.set_string_value(str(dt_id)) else: dtpRec.name.set_string_value(str(name)) return str(diVal) processInput.deps = ('DI001589','DI003389')
def computeSqlValueRange(dt_name): """Calculate the number of data area assignments""" val = """ select count(*) from DT406 where di000969={0}.di000198 """.format(dt_name) return str(val)