Limiting the values of operator input setpoints

I am using an input box to allow users to input setpoints into the system. These setpoints are bound by allowing high and low limits. If the operator enters a value outside of the limits, then I would like to prompt the operator and prevent a write to the database (its looks like it would bound the input to the limit and write the limit to the database–not sure if that is really what is going on, but it looks that way).

I have two different scenarios for this. In the first, I can “hard code” the limits (enter a time setpoint between 0 => 300 seconds).

In the second, the operator is entering a setpoint in a table. The values in the table are all operator inputtable. So, if the operator enters a value for the stage 2 setpoint, it must be greater than the operator input for stage 1 and less than the operator input for stage 3. If the value is not between those two limits, then a dialog box should prompt the operator and not write a value to the database.

Below is an idea support gave me, but it seems that it is lacking some basic components for this

new = event.source.value
old = 10
lowmin = event.source.parent.getComponent('StageReadout0').floatValue
highmin = event.source.parent.getComponent('StageReadout2').floatValue
if new <lowmin>= highmin:
	event.source.value = old
	fpmi.gui.warningBox("Value above Stage 2")

Any help would be greatly appreciated!

Hello,

First of all, I would approach this problem without scripting entirely. Use the Numeric Text Field, which has a notion of a minimum and maximum built-in (enable it by checking the “Use Bounds” property). Then just bind your minimums and maximums to the values of the input boxes that they are dependent on.

For example, bind (no scripting!) Stage2.Minimum to Stage1.IntValue.

Now Stage2’s minimum is stage 1’s value.

Hope this helps,