Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
- I had stored all selections of different listboxes in one variable with seperating each selection with comma.
- if i not selecting any one listbox i'm getting the comma but i want to remove this comma if i not selected that listbox.
In button action i return for variable like this: =GetFieldSelections(F1,',',50)&','&GetFieldSelections(Group,',',50)&','&GetFieldSelections(Group1,',',50)
Eg:
I have three fields F1,Group,Group1 and taken in different listboxes. And i'm taken one variable for storing the seleted data of those listboxes with seperating comma. If i'm not selecting Group,Group1 . I'm getting the output of variable like : G,,
Here i want to remove ,,
I'm attaching my qvw file also for your reference.
Hi,
Try this out.
=GetFieldSelections(F1,',',50)&
if(GetSelectedCount(F1) > 0 and (GetSelectedCount(Group) > 0 or GetSelectedCount(Group1)) ,',')&
GetFieldSelections(Group,',',50)&
if(GetSelectedCount(Group1) > 0 and GetSelectedCount(Group) > 0,',')&
GetFieldSelections(Group1,',',50)
Regards,
Kaushik Solanki
Hello Jacq,
Those are result of the concatenation (the &',,'& part between GetFieldSelections). You will need to add more conditionals so if the GetFieldSelections(Group, ',', 50) length is greater than zero, then use it, othwerwise null, or something.
=GetFieldSelections(F1,',',50)&If(Len(GetFieldSelections(Group,',',50)) > 0, ','&GetFieldSelections(Group,',',50)&If(Len(GetFieldSelections(Group1,',',50)) > 0, ','&GetFieldSelections(Group1,',',50)))
Hope that helps.
BI Consultant
But if i not select Group listbox it is not storing Group1 data also..
Hi,
Then you will have to add more conditionals to control all possibilities or use a different function to get different values and concatentate them, using Concat() for example, and in your macro, depending on the length of the three concats() (one per each F1, Group and Group1) create the variable in accordance.
Hope that helps.
BI Consultant
Hi,
Try this out.
=GetFieldSelections(F1,',',50)&
if(GetSelectedCount(F1) > 0 and (GetSelectedCount(Group) > 0 or GetSelectedCount(Group1)) ,',')&
GetFieldSelections(Group,',',50)&
if(GetSelectedCount(Group1) > 0 and GetSelectedCount(Group) > 0,',')&
GetFieldSelections(Group1,',',50)
Regards,
Kaushik Solanki
kaushik,
Your code is working but i need small favour from you..
Can you plz write above code for 9 fields. like G1,G2,G3,G4,G5,G6,G7,G8,G9.
B'coz i'm not able to implement your code for 9 fields...
Hi,
Let me tell you the logic this will help you to make it done.
Look at the expression.
After 1st get selection of F1 i gave 3 condition in if statement. and then as we go down it decreases.
So same you have to do for 9 fields.
Something like this.
=GetFieldSelections(G1,',',50)&
if(GetSelectedCount(G1) > 0 and (GetSelectedCount(G2) > 0 or GetSelectedCount(G3)) >0 ......... or GetSelectedCount(G9) >0 ,',')&
GetFieldSelections(G2,',',50)&
if(GetSelectedCount(G2) > 0 and GetSelectedCount(G3) > 0...........GetSelectedCount(G9) >0',')&
GetFieldSelections(G3,',',50).............................
GetFieldSelections(G9,',',50)
Try you will for sure can do this.
Regards,
Kaushik Solanki
Thanks a lot kaushik..I implemented your logic.