How to prevent the first record from being changed

Discussions about CSEntry
Forum rules
New release: CSPro 8.0
Post Reply
juan pablo
Posts: 30
Joined: July 27th, 2017, 4:02 pm

How to prevent the first record from being changed

Post by juan pablo »

Dear josh

I have a query, I am using the ramdon statement in a numeric variable.
So the problem is that when going back to that variable, the value that came out of the
  Ramdon changes and what I want is the first record thrown by the ramdon. How can i fix this?

I'm using the following logic


PROC ROTAR1

preproc

IF $=MISSING OR $=NOTAPPL THEN
$ = random(1,5);
noinput;
endif;



Regards
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: How to prevent the first record from being changed

Post by josh »

If you are in system controlled mode then you will need to use visualvalue when looking at the value of the variable for the proc you are on. This is because is in the preproc of a variable, that variable is considered "off path". The same as if you were in a field before that one on the form. In system controlled mode variables that are after the current field on the form are or are skipped are notappl in logic. To get the value in these cases you can use visualvalue.

So if the field is currently blank then visualvalue($) in the preproc will be notappl in which case you set it to a random number. Otherwise you leave the value that is already in the field.
PROC ROTAR1

preproc

if visualvalue($)=NOTAPPL then
    $ =
random(1,5);
endif;
noinput;
juan pablo
Posts: 30
Joined: July 27th, 2017, 4:02 pm

Re: How to prevent the first record from being changed

Post by juan pablo »

Thank you very much for the estimated information josh
Taking advantage of the occasion, I have another query.
Is there a way to return to a variable that had previously jumped and left blank, using the reenter? for example :

Another query, I have 5 variables which must be completed all ejm
P1
P2
P3
P4
P5
That in my ejm start with P3-> P4-> P5 and return to P1-> P2 so that you finish filling the others and have all the boxes complete, The idea is that they are always stuffed and what if it changes is the order where Is started and once filled all continue with the other questions
All this using system control





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

Re: How to prevent the first record from being changed

Post by Gregory Martin »

It's possible, but isn't easy. It requires adding a control field before P1. In your scenario, that control field would initially skip to P3. Then, after P5, you would reenter the control field, and in the onfocus event of that field, you would start entering P1.

It's not simple to do, so unless you absolutely need to, I would try to restructure how your data is collected.
Post Reply