Page 1 of 1

Creating a dynamic valueset

Posted: February 6th, 2022, 11:35 pm
by sham
Hello Family,
Let say a have 4 variables, J1_1, J1_2, J1_3, J2

Var1: J1_1 asked to make a 1st choice from a list of crops.....(single select)

crops: 1 Maize
2 Soy
3 Groundnut
4. Beans


Var2 : J1_2 asked to select the 2;d most important crop,,,,.....(single select)

Var3: J1_3 Asked for the 3rd choice ,,,,.....(single select)

Var4 J2: This variable also asked among the 3 which one is the main crops.
So i needed a guided so that after making the 1st 3 choices from (J1_1, J1_2 and J1_3) in J2 i should see only the option selected previously in J1_1, J1_2 and J1_3 respectively.... instead of bringing all the list.
I attached the Cspro program file for your attention.

I will be very glad for your help family.

Thanks
Sham.

Re: Creating a dynamic valueset

Posted: February 7th, 2022, 5:19 am
by etuser
Hi Sham,

I tried to modify your program, please see the attached file .

Re: Creating a dynamic valueset

Posted: February 7th, 2022, 6:56 am
by sham
@etuser
Thanks so much for giving me an alternative...

But still hoping from others if its possible to still maintain the initial structure that will be super.

Re: Creating a dynamic valueset

Posted: February 7th, 2022, 10:02 am
by ares
Hi Sham

I just copy the logic that is what I propose to you (as i used 7.5)
//////////////////////////////////////////////////////////////////////
PROC J2
//for this one you can put the valueset of the previous variables
onfocus
valueset J2_VS;
J2_VS.add(J1_1_VS1, J1_1);
J2_VS.add(J1_2_VS1, J1_2);
J2_VS.add(J1_3_VS1, J1_3);
setvalueset(J2, J2_VS);
//following line is not necessary if you put the capture type pf this field
setproperty(J2,"CaptureType", "RadioButton");
//////////////////////////////////////////////////////////////////////
//But you may need to drop already choosen modalities in J1_2 an J1_3
//////////////////////////////////////////////////////////////////////
PROC J1_2
//Make sure you remove what was in J1_1.
//Eventhough I don't see option no second crop
Onfocus
valueset J1_2_VS = J1_2_VS1;
J1_2_VS.remove(J1_1);
setvalueset(J1_2, J1_2_VS);

PROC J1_3
//Make sure you remove what was in J1_1 and J1_2.
//Eventhough I don't see option no third crop
Onfocus
valueset J1_3_VS = J1_3_VS1;
J1_3_VS.remove(J1_1);
J1_3_VS.remove(J1_2);
setvalueset(J1_3, J1_3_VS);

Re: Creating a dynamic valueset

Posted: February 8th, 2022, 10:18 pm
by sham
Thanks soo much ares.
May God bless all of you for your lovely comments.

May Allah continue to bless this family with more knowledge and Good health.

Thanks.
Sham