Import operator list in assignment group

Hi,

I'am trying to import operators in assignment group with text import wizard but my problem is that when importing, the wizard don't verify if the operator exist or not in the assignment group, and found that there are duplicates operators. 

I tried to use Format control to compare existing data and imported data to delete the duplicated operators, but can't really find the solution.

Any help would be appreciated !

  • Verified Answer

    FC for Assignment

    Calculations:

    Update - not same(hpc.assignees in $file, hpc.assignees in $file0)

    Calculate - hpc.assignees in $file=jscall("YourLIB.sortArrayAndRemoveNullsAndDuplicates", hpc.assignees in $file)

    function sortArrayAndRemoveNullsAndDuplicates(oldarray)
    {
          var newarray = new Array();
          newarray = RemoveNullsAndDuplicates(oldarray);
          
          return newarray.sort();
    }
    
    function DeleteNullsAndDuplicatesFromSCArray(mas){
    	
    	/*
    		function deletes nulls and duplicates fron array
    		arr - the array in whom it is necessary to delete nulls and duplicates.
    		
    		function returns updated array.
    	*/
    	return RemoveNullsAndDuplicates(mas);
    }
    
    
    function RemoveNullsAndDuplicates(array){
    	
    	/*
    		function deletes nulls and duplicates fron array
    		arr - the array in whom it is necessary to delete nulls and duplicates.
    		
    		function returns updated array.
    	*/
    	var ans = new Array();
    	
    	for (var i in array){
    		if (array[i]!=null && array[i]!="" && system.functions.index(array[i] , ans)<1){
    			ans.push(array[i]);
    		}
    	}
    	return ans;
    }
    
    function RemoveNulls(array){
    	
    	var ans = new Array();
    	for (var i in array){
    		if (array[i] != null && array[i] != ""){
    			ans.push(array[i]);
    		}
    	}
    	return ans;
    }
  • Thank you for your response, 

    Your solution worked for me by changing the Update - not same(hpc.assignees in $file, hpc.assignees in $file0)   

    to Update - true.

    Another question please : How can i do to control the import :

    - Import operators to existing group.

    - Do nothing if the group doesnt exist ( in our case now, if the group doesnt exist , the wizart create new group)

     

    Thank you again.