Requesting logic

What would you like to see in CSPro?
Forum rules
New release: CSPro 8.0
Post Reply
amha_123456
Posts: 1
Joined: February 12th, 2021, 2:52 am

Requesting logic

Post 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
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Requesting logic

Post 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());
Post Reply