Hi,
I'm new to SB+ development so please excuse any ignorant questions.
I'm trying to amend a screen to:
Add a field that should be forced to 'N' unless 2 prior entered fields have particular values.
If the prior fields meet the conditions the user should be able to optionally change the value to 'Y'
If the prior fields don't meet the condition the user should not be able to change the value.
What would be the cleanest/best practice way to achieve this?
Regards,
Jonathan
Hello Jonathan,
One way to do it is to set your default value in the field definition and then use the Process Before field in the /SD tool to conditionally data stack the value.
For example,
/SD > F5 - Enter Field > Process Before: P:(IF FLD1 = 'X' AND FLD2 = 'Y' THEN DATA 'N')
Mark.
Hi,
I'm new to SB+ development so please excuse any ignorant questions.
I'm trying to amend a screen to:
Add a field that should be forced to 'N' unless 2 prior entered fields have particular values.
If the prior fields meet the conditions the user should be able to optionally change the value to 'Y'
If the prior fields don't meet the condition the user should not be able to change the value.
What would be the cleanest/best practice way to achieve this?
Regards,
Jonathan
Mark's Response works well, but if you want the user to be able to stay on the field (e.g. to read the Help Reminder) you an add a Validation in the Field-Definition similar to this:
E:FLDA = "X" & FLDB = "Y" & @VALUE = "Y"{"Field A must be 'X' and Field B must by 'Y' to enter 'Y' here}
In this Case the filed is not automatically skipped if the previous fields doesn' match the criteria.
Hi,
I'm new to SB+ development so please excuse any ignorant questions.
I'm trying to amend a screen to:
Add a field that should be forced to 'N' unless 2 prior entered fields have particular values.
If the prior fields meet the conditions the user should be able to optionally change the value to 'Y'
If the prior fields don't meet the condition the user should not be able to change the value.
What would be the cleanest/best practice way to achieve this?
Regards,
Jonathan
hi Jonathan
the best is to define a default expression with skip and mandatory + Recalc Field affect Other on screen
Field DEFN FLD3 : 'Default' : IF(FLD1='X' AND FLD2='Y','N'[S],@VALUE)[M]
which means : IF FLD1='X' AND FLD2='Y' THEN value='N' + Skip input ELSE value=@VALUE (let the current value) and make input ; add [M] to force the evaluation at each pass.
then, on the ScreenDefn, F10, Recalc, you add two lines
- FLD1 -> FLD3
- FLD2 -> FLD3
then if the user change FLD1 or FLD2 and strike {F2} or use mouse two go elsewhere than FLD3 your value is always updated at validation of FLD1 or FLD2
! if you do not define Recalc, the user MUST pass on the step of the FLD3 field to update the value.
I suggest to add into Process After Accept (global check of the record values before writing)
FLD3 = IF(FLD1='X' AND FLD2='Y', 'N', FLD3)
manu
Hi,
I'm new to SB+ development so please excuse any ignorant questions.
I'm trying to amend a screen to:
Add a field that should be forced to 'N' unless 2 prior entered fields have particular values.
If the prior fields meet the conditions the user should be able to optionally change the value to 'Y'
If the prior fields don't meet the condition the user should not be able to change the value.
What would be the cleanest/best practice way to achieve this?
Regards,
Jonathan
Thanks all for the assistance. Very helpful.