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 |
computeOutput()
and processInput()
to the underlying DI's type.
Python error in value range of DI041035 "di_customizing_name": computeOutput <class 'TypeError'>: argument must be string, not None
checkInput()
function of a Python value range, while processInput()
will be evaluated.
checkInput()
function is evaluated before processInput()
is called.
checkInput()
will inhibit calling processInput()
when it does not accept the input.
computeOutput()
is evaluated whenever the DI's value is read. No evaluation might happen when PLANTA Server is in echo off mode (using ppms.echo_off()
or ppms.echo_disabled()
), as PLANTA Server refreshes the DI-values during the serialization step (which is skipped in echo off mode).
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.
computeOutput()
function: computeOutput()
function is always up to date according to its source references.
computeOutput()
processInput()
checkInput()
computeOutput()
is customized on DI123456 it's not necessary to add DI123456 to the dependencies.
deps = ('',)
deps = ('DI012345',)
deps = ('name',)
.
deps = ('Module.name',)
.
DI000000
instead of di000000
. import random def computeOutput(di): list = ppms.uvar_get('@M6') return random.choice(list) computeOutput.deps = ('@M6',)
computeOutput()
depends on @M6 variable.
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 # either: #checkInput.deps = ('DI040154', 'DI040156', 'DI040155', ) # or: checkInput.deps = ('compl_in', 'compl_on', 'compl_by', )
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) # either: #processInput.deps = ('DI001589', 'DI003389', ) # or: processInput.deps = ('name', 'dt_title', )
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)