1. ## Choice Group

Hi all,

I got some roblem in my application i need to create choice group for
multiple choces
call choicegroup XYZ Choices A, B, C, D
at a time user has to select only 2 or 1 from 4 ie restricting the
choces to only 2 or 1 choices it can be of any combination and i given
values A=1, B=2, c=3 d=4 if user selects A and D the value for choice
group becomes avg of 2 ie 2.5
is that possible by using getselectedflags or any other clue

Kind Regards
Jay

for the present choice group i created is an exclusive one i need to use MULTIPLE choice group for this. ie id choice1 and 2 selected LTS value becomes 1.5 and 2 and 3 LTS=2.5.
if(item==LTSimpleHairs)
{

int LTSimpleHairs1=LTSimpleHairs.getSelectedIndex();
switch(LTSimpleHairs1)
{
case 0: LTS=1;
System.out.println("Cordate Selected");
break;
case 1: LTS=2;
System.out.println("Truncate Selected");
break;
case 2: LTS=3;
System.out.println("Cuneate Selected");
break;
}
}

2. ## Re: Choice Group

Sorry buddy i dont understand what exactly you want.Can you pLease explain it more .Only the thing i understand is that you have created text box and you want that if you choose 1 and 3 it will give value 2 , if you choose 2 and 3 it will give value 2.5 .Tell me am i right so that i can help you

3. ## Re: Choice Group

Hi chauhan,

i need to create Choice group of type MULTIPLE in that there will be an three choices (A, B, C)and user can select only 1 or 2 option like A,B,C or AB,BC,CA not all option ie ABC. Depending on the value selected i need to set the value for an variable for A selected set x=1,for B set x=2 for c set x=3 like that,
if user selects two option
ex:AB selected set x=1.5
BC selected set x=2.5
CA selected set x=2

4. ## Re: Choice Group

OHk lets do the Simple thing

Create ONe for loop which run up to choice ground data size i mean String Array size you have passed .Now check the getSelected Flag and Make one counter if getSelected Flag True then increase counter and do one more things add all these value which are selected.Like this

int total_Value,counter;
for(int i =0;i<size,i++){
if(choicegroup.getselectedflag){
counter++;
total_Value=(i+1)+total_Value;
}
}

int final_Result=total_value/counter;

Try this .Lets me know and sorry i didn put complete syntex i hope you understand.

5. ## Re: Choice Group

Hi chauhan

Thank u for ur reply i got the solution i have simple modification to ur code.

if(item==LeafBase)
{

int LeafBase1=LeafBase.getSelectedFlags(res);
double total_Value=0,counter=0,j;

for(int i =0;i<3;i++){
if(LeafBase.isSelected(i)){
if(LeafBase1<=2){
counter++;
System.out.println("final result"+counter);
total_Value=(i+1)+total_Value;
System.out.println("final result"+total_Value);
}
else{
}
}
}
System.out.println("final counter"+counter);
System.out.println("final total_Value"+total_Value);
LB1=(total_Value/counter);
System.out.println("final result"+LB1);

}

This working fine if u see any modification please change it
Thanks and Regards

6. ## Re: Choice Group

Welcome buddy
The code is fine so don't worry

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•