Page 1 of 1

How to prevent the first record from being changed

Posted: August 7th, 2017, 11:33 pm
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

Re: How to prevent the first record from being changed

Posted: August 8th, 2017, 7:14 am
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;

Re: How to prevent the first record from being changed

Posted: August 9th, 2017, 3:55 pm
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

Re: How to prevent the first record from being changed

Posted: August 14th, 2017, 9:40 am
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.