Page 1 of 1

Requesting logic

Posted: February 13th, 2021, 4:53 am
by amha_123456
Hi CSpro users,
I had difficulty in managing two rosters at a time.
The first roster is only to record available commodities asking Yes/No questions.
The second bring 'yes' responses and ask too money questions.
Lets say 'orange' is selected in the first roster of first row . it will come to the second roster being first row.
i want 'orange' also to be in the second row of second roster . can you help on how to do this?
Thanks

Re: Requesting logic

Posted: February 16th, 2021, 2:37 pm
by josh
You can copy from one roster to another using subscripts. For example if have two rosters: ROSTERA and ROSTERB where ROSTERA has a field NAMEA and ROSTERB has a field ROSTERB then you can copy from row 3 of ROSTERA to row 3 of ROSTERB by doing something like NAMEB(3) = NAMEA(3).

To copy every row of the roster you can use a loop from 1 to the size of the roster (which can you can get using the totocc() function) and use the above to copy the value from each row. Something like:

do numeric rowNum = 1 while rowNum <= totocc(ROSTERA)
NAMEB(rowNum) = NAMEA(rowNum);
enddo;

You would do the above before entering ROSTERB.

Alternatively if you are in a field on ROSTERB you can use the currocc() function as the subscript to copy the current row:

PROC NAMEB
preproc
NAMEB(currocc()) = NAMEA(currocc());