- I did a form that get the users assigned resources in one pick-list
and the available resources in another pick-list.
- Then we select the resources to remove and resources to add from the 2
different pick-lists.
- Then, 2 loops remove the resources selected in pick-list one and add
resources in pick-list two.
This works fine, but off course, the GUI is not very nice...
So now I managed to get only one 2-way pick-list that is filled with all
available resource and I have selected (field.select()) the currently
assigned resources on the left.

I kept (hidden) the pick-list with currently assigned resources, so at
the end of the selection, I have:
- An array with the currently assigned resources : A,B
- An array with the new choice for assigned resources: AC

And I'm struggling to compare the to arrays to get the list of resources
to ADD and to REMOVE --> C to add and B to remove.
>Everything that is not in picklist-1 and in picklist-2 must be added
>Everything that is not in picklist-2 and in picklist-1 must be removed

I found this on the net , which looks "nice", but it does not work (no

function intersect_arrays(a, b) {
var sorted_a = a.concat().sort();
var sorted_b = b.concat().sort();
var common = [];
var a_i = 0;
var b_i = 0;

while (a_i < a.length
&& b_i < b.length)
if (sorted_a[a_i] === sorted_b[b_i]) {
else if(sorted_a[a_i] < sorted_b[b_i]) {
else {
return common;

Does anyone has any idea or did that already ?



sma's Profile: https://forums.netiq.com/member.php?userid=174
View this thread: https://forums.netiq.com/showthread.php?t=56925