Automatically copy $(i) values to $(i+1)

Discussions about CSEntry
Forum rules
New release: CSPro 8.0
Post Reply
htuser
Posts: 631
Joined: December 19th, 2011, 6:26 pm
Location: Silver Spring Area, MD, USA

Automatically copy $(i) values to $(i+1)

Post by htuser »

Other, assuming that i've a roster with two columns (CODE1 and CODAGE) and ten row i would like that the fisrt value entry by the operator in (CODE1(1))to be automatically copied in (CODE1(2)) or (CODE1(i+1) in the preproc.
it's because i write this code:
PROC GLOBAL
numeric i;
PROC CHAMP_FF
PROC CODE1
Preproc
i=1;
if i=1 then next // This instruction do not concern the first value entered by operators
else // if i>1
$(i) = $(i-1);// Copy the values of the first i, j to the second i, j so that $(2)=$(2-1), finally $(2)=$(1)
endif;
but, until now, no effect ...

Can anyone can help me please?
Thanks in advance,
G.VOLNY, a CSProuser from Haiti, since 2004
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: Automatically copy $(i) values to $(i+1)

Post by Gregory Martin »

If you look at your logic, you'll see that the variable i will always be 1. For every occurrence, CODE1(1), CODE1(2), ..., i will be 1, so you'll always execute the next statement. Set i = curocc(); and your code should work.
htuser
Posts: 631
Joined: December 19th, 2011, 6:26 pm
Location: Silver Spring Area, MD, USA

Re: Automatically copy $(i) values to $(i+1)

Post by htuser »

Thanks.
That's work fine.
G.VOLNY, a CSProuser from Haiti, since 2004
Post Reply