i cannot modify value from global part

Discussions about CSEntry
Post Reply
Jing Liu
Posts: 42
Joined: July 1st, 2015, 3:19 am

i cannot modify value from global part

Post by Jing Liu »

Hi,

i found a strange thing that i am not sure if cspro is intended to do that or not.

I plan to do some calculation in the global part, and then write a value into a field in the same dictionary from the global logic part. I find that, if the field is empty (never saved before), it works. But once the field has been saved in a data file, i cannot modify the value from global part.

e.g. i have done the calculation before, and got a value 0, it was stored in the data file. when next time if i got a new value 1, it was calculated correct in the global part, but the moment I got into the form (Supervisor_control), it disappeared, instead the old value from the data file was loaded.

as you seen in the attached file, there is nothing between the end of global part and the begin of form part.
logic.PNG
logic.PNG (20.95 KiB) Viewed 3300 times
Capture.PNG
Capture.PNG (9.11 KiB) Viewed 3300 times
best

jing
Gregory Martin
Posts: 1796
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: i cannot modify value from global part

Post by Gregory Martin »

Jing and I emailed a bit about this. The reason for the problem may be more clear with an explanation of when data is loaded. When you go into modify mode:

1) The logic in the _FF (form file) PROC is executed.

2) The data is loaded.

3) The logic in the first level PROC is executed.

So if you updated any values in step #1 while in modify mode, those values will be overwritten when the data is loaded in step #2. If you want any calculations to persistent, then they have to be done in step #3, the preproc of the first level PROC.
Jing Liu
Posts: 42
Joined: July 1st, 2015, 3:19 am

Re: i cannot modify value from global part

Post by Jing Liu »

thanks! it is solved!
Post Reply