Hello,
I ask for help to write a logic.
Indeed, I realize a data collect in focus group for which, I must inform the function of each member in the group in the variable whose name is LDP_3.
However 2 people can not occupy the same function apart from those who are simple members whose code is 6. The other functions have the following codes: President = 1, Treasurer = 2, Secretary = 3, Advisor = 4 and Warehouse = 5.
The code on the image is written but it only works for a gap of 1 between the rows of the array. At the end of 1 this does not work anymore.
I would like help with writing a global code.
There is also a variable that provides information on the number of focus group participants whose name is NPFG.
Thank you
Logics in table
Logics in table
- Attachments
-
- Capture.PNG 1.PNG (4.95 KiB) Viewed 3378 times
-
- Capture.PNG (10.74 KiB) Viewed 3378 times
Re: Logics in table
I'm not certain I understand the behavior. Is the goal to add a check, so no two members are a president, treasurer, secretary, adviser, or warehouse?
Re: Logics in table
yes it's my goal
Re: Logics in table
Here's a simple implementation of a check that will warn you if more than one member is a president, treasurer, secretary, adviser, or warehouse. Notice that the check runs at the end of the roster.
PROC ROSTER_CHECK_REC000
postproc
numeric presidentCount = 0;
numeric treasurerCount = 0;
numeric secretaryCount = 0;
numeric adviserCount = 0;
numeric warehouseCount = 0;
do numeric i = 1 while i <= soccurs(ROSTER_CHECK_REC)
if ROLE(i) = 1 then
inc(presidentCount);
elseif ROLE(i) = 2 then
inc(treasurerCount);
elseif ROLE(i) = 3 then
inc(secretaryCount);
elseif ROLE(i) = 4 then
inc(adviserCount);
elseif ROLE(i) = 5 then
inc(warehouseCount);
endif;
enddo;
if presidentCount > 1 then
errmsg("Warning there are %d presidents!", presidentCount);
endif;
if treasurerCount > 1 then
errmsg("Warning there are %d treasurers!", treasurerCount);
endif;
if secretaryCount > 1 then
errmsg("Warning there are %d secretary!", secretaryCount);
endif;
if adviserCount > 1 then
errmsg("Warning there are %d adviser!", adviserCount);
endif;
if warehouseCount > 1 then
errmsg("Warning there are %d warehouse!", warehouseCount);
endif;
postproc
numeric presidentCount = 0;
numeric treasurerCount = 0;
numeric secretaryCount = 0;
numeric adviserCount = 0;
numeric warehouseCount = 0;
do numeric i = 1 while i <= soccurs(ROSTER_CHECK_REC)
if ROLE(i) = 1 then
inc(presidentCount);
elseif ROLE(i) = 2 then
inc(treasurerCount);
elseif ROLE(i) = 3 then
inc(secretaryCount);
elseif ROLE(i) = 4 then
inc(adviserCount);
elseif ROLE(i) = 5 then
inc(warehouseCount);
endif;
enddo;
if presidentCount > 1 then
errmsg("Warning there are %d presidents!", presidentCount);
endif;
if treasurerCount > 1 then
errmsg("Warning there are %d treasurers!", treasurerCount);
endif;
if secretaryCount > 1 then
errmsg("Warning there are %d secretary!", secretaryCount);
endif;
if adviserCount > 1 then
errmsg("Warning there are %d adviser!", adviserCount);
endif;
if warehouseCount > 1 then
errmsg("Warning there are %d warehouse!", warehouseCount);
endif;
Re: Logics in table
thanks aaronw.
It work
It work