Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hey Guys, I need a help in here.
I have 3 lists like these:
List 1 (Removes from Result when Selected) | List 2 (Adds on Result when Selected) | List 3 (Result) |
---|---|---|
Optional 1 | Optional 1 | Optional 1 |
Optional 3 | Optional 2 | Optional 3 |
Optional 4 | Optional 3 | Optional 4 |
Optional 6 | Optional 4 | Optional 6 |
Optional 9 | Optional 5 | Optional 9 |
Optional 13 | Optional 6 | Optional 13 |
Optional 19 | Optional 7 | Optional 32 |
Optional 27 | Optional 8 | Optional 40 |
Optional 32 | Optional 9 | Optional 2 |
Optional 40 | Optional 10 | Optional 12 |
Optional 11 | Optional 14 | |
Optional 12 | Optional 15 | |
Optional 13 | ||
Optional 14 | ||
Optional 15 |
The thing is:
The 'RESULT LIST' has EVERYTHING that the 'LIST 1' does, although, what is selected on 'LIST 1' removes from the 'RESULT LIST' (It's like if you have those Optionals already pre-selected but you have to say which one you DON'T WANT TO, like buying a car.)
And the 'LIST 2' does the Opposite, it has ALL the Optionals, from 1 to 99 we can say, and when selected, it ADDS to the 'RESULT LIST' instead of removing it like 'LIST 1' does.
So, in the example above I'm:
REMOVING the 'Optional 19' and the 'Optional 27' from the 'RESULT LIST' you can see those selections don't appear there AND
ADDING the 'OPTIONAL 2, 12, 14 and 15' from the 'LIST 2' to the 'RESULT LIST'.
Thank you in advance!
Ok, well I did not thought of your approach. This looks great to me.
To resolve it, you can use below expression for vPre_OPT variable
=replace(chr(39)&Concat({1-$}[OPTIONALS PRE-SELECTED], ',') &chr(39),',',chr(39)&','&chr(39))
And then =ValueList($(vPRE_OPT),$(vALL_OPT))
Thanks,
Angad
Can you please attach a sample QVW file with expected results. That will help you get quick answers.
-Angad
Sure, there we go.
So, I left some selections already like this:
List 1 PRE-SELECTED (Removes when Selected) | List 2 ALL OPTIONALS (Adds when Selected) | Result |
---|---|---|
Optional 1 | Optional 3 | (Everything on List 1, REMOVING the Red Selections) |
Optional 14 | Optional 4 | Optional 3 |
Optional 15 | Optional 5 | Optional 4 |
Optional 16 | Optional 6 | Optional 5 |
Optional 26 | Optional 7 | Optional 6 |
Optional 28 | Optional 8 | Optional 7 |
Optional 37 | Optional 19 | Optional 8 |
Optional 27 | Optional 20 | Optional 19 |
Optional 39 | Optional 21 | Optional 20 |
Optional 41 | Optional 30 | Optional 21 |
Optional 42 | Optional 1 | Optional 30 |
Optional 43 | Optional 2 |
So, the 'RESULT LIST' should have everything on 'LIST 1' without the Selections PLUS Adding the Selections from 'LIST 2'.
Hello,
Please find the attached document. This is one such way, which came up in my mind.
We are setting values of selected fields into variables and then passing these variables at the script.
Hope it helps.
Thanks,
Angad
Thank you for replying, your idea is totally correct.
However, since my 'LIST 1' is a variable list coming from more then one XLS, I can't set them.
What I tried to use is creating 2 Variables like these:
(vALL_OPT For ALL OPTIONALS)
=Chr(39)&Replace(GetFieldSelections([ALL OPTIONALS],',', GetSelectedCount([ALL OPTIONALS])), ',' , chr(39)&','&chr(39)) &chr(39)
(vPRE_OPT For PRE-SELECTED)
=Chr(39)&Replace(GetFieldSelections([OPTIONALS PRE-SELECTED],',', GetSelectedCount([OPTIONALS PRE-SELECTED])), ',' , chr(39)&','&chr(39)) &chr(39)
And adding this to a List Expression:
=ValueList($(vPRE_OPT),$(vALL_OPT))
So the List changes as the Optionals are selected (I mean, in real time), that's what I need mostly!
However, my Expression or Variable is wrong because with this Expression, I'm Adding the values of 2 lists into one, and I need 1 to add and 1 to remove, as I explained.
It's a little bit hard to understand i confess, if you need something, let me know please! I do need to get this working!
Thank you so much!
Ok, well I did not thought of your approach. This looks great to me.
To resolve it, you can use below expression for vPre_OPT variable
=replace(chr(39)&Concat({1-$}[OPTIONALS PRE-SELECTED], ',') &chr(39),',',chr(39)&','&chr(39))
And then =ValueList($(vPRE_OPT),$(vALL_OPT))
Thanks,
Angad
Thank you so much.