Page 1 of 1

Assigning fields out of the flow

Posted: July 15th, 2018, 9:14 am
by AriSilva
As I understood, a field in a form is changed only when the system flow passes through the field in the program logic.
But sometimes it is necessary to change (or assign) the value of a field in a proc of another variable, without having to MOVE back to the previous field. I´ve tried that and it does not work, unless the flow of control returns to the field you want to change.
Is there a way to change the value of a field without being in its own proc?

Re: Assigning fields out of the flow

Posted: July 19th, 2018, 6:21 am
by aaronw
You don't need to move back to a previous field to update its value. You simple reassign it further down in the flow. For example, FIELD_1 is reassigned the value of FIELD_2 in PROC FIELD_2.
PROC FIELD_2

postproc

    FIELD_1 = FIELD_2;

Re: Assigning fields out of the flow

Posted: July 19th, 2018, 9:07 am
by AriSilva
But if the control does not pass thru the field, or if the field is in another form, which is never used, the field is not assigned.

Re: Assigning fields out of the flow

Posted: July 22nd, 2018, 4:23 am
by aaronw
CSPro was designed to ignore values off path. However, the assignment is made, but when the data is written out it is ignored. During a partial save all values (on or off path are saved). This is done, so a skip doesn't immediately wipe a bunch of collected data. If you maintain a partial save (never letting the case complete) you can achieve the behavior you want.