Dear CSPRo Community
I have an itemized list running from 1 to 139 items in a roster. However, I don’t want to select this list sequentially. I want to select this list in any order. To avoid inadvertently selecting the same item more than once, if any item is selected from the list that item be automatically removed from the list or drops off from the list, so that you won’t the see the item again in the list. I don’t know if this can be possible in CSPRO.
Attached is the roster, am working on. Thank you.
Remove a Value based on a Previous Selection in a roster.
Remove a Value based on a Previous Selection in a roster.
- Attachments
-
- ihs3_test.zip
- (101.04 KiB) Downloaded 215 times
-
- 2020-02-22.png (114.24 KiB) Viewed 3810 times
-
- Posts: 37
- Joined: August 17th, 2018, 6:09 am
Re: Remove a Value based on a Previous Selection in a roster.
Removing a Value Based on a Previous Selection
Sometimes a questionnaire has a series of questions that asks about preferences, such as, “What is your favorite color?,” and then, “What is your second favorite color?” The list of options for the second question can exclude the selected answer to the first question. The valueset object makes this task very easy:
PROC SECOND_FAVORITE_COLOR
preproc
valueset second_favorite_color_vs = FAVORITE_COLOR_VS;
second_favorite_color_vs.remove(FAVORITE_COLOR);
setvalueset(SECOND_FAVORITE_COLOR, second_favorite_color_vs);
Sometimes a questionnaire has a series of questions that asks about preferences, such as, “What is your favorite color?,” and then, “What is your second favorite color?” The list of options for the second question can exclude the selected answer to the first question. The valueset object makes this task very easy:
PROC SECOND_FAVORITE_COLOR
preproc
valueset second_favorite_color_vs = FAVORITE_COLOR_VS;
second_favorite_color_vs.remove(FAVORITE_COLOR);
setvalueset(SECOND_FAVORITE_COLOR, second_favorite_color_vs);
Re: Remove a Value based on a Previous Selection in a roster.
Arjun,
Thanks for clarifying. As you can see the values and selection does not depend on any values selected before. So, I am looking for a solution that will drop values that have been selected so that they won't appear again. This is necessary to avoid inadvertently selecting any value more than once.
Does CSPro provide solutions for this kind of problems? Please help.
Thanks for clarifying. As you can see the values and selection does not depend on any values selected before. So, I am looking for a solution that will drop values that have been selected so that they won't appear again. This is necessary to avoid inadvertently selecting any value more than once.
Does CSPro provide solutions for this kind of problems? Please help.
Re: Remove a Value based on a Previous Selection in a roster.
In Arjuns example FAVORITE_COLOR is a previous selection. In your case, since there are multiple previous selections you will need to loop to remove all the previous selections. Loop from 1 to the current row of the roster (use currocc() function to get the current row) and remove the value chosen at each row from the selection.
Something like:
Something like:
Code: Select all
valueset vs = ITEMS_VS;
do i = 1 while i < currocc()
vs.remove(ITEMS(i))
enddo;
setvalueset(ITEMS, vs);
Re: Remove a Value based on a Previous Selection in a roster.
Thank you Josh. This is exactly the solution am seeking. Now is working. Many many thanks, Josh.
Re: Remove a Value based on a Previous Selection in a roster.
I have not get it clear can you send the program with those codes so that i can see how it works? Thank You