Highlighted
Contributor.
Contributor.
400 views

Import operator list in assignment group

Jump to solution

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 !

0 Likes
1 Solution

Accepted Solutions
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Import operator list in assignment group

Jump to solution

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;
}

View solution in original post

2 Replies
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Import operator list in assignment group

Jump to solution

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;
}

View solution in original post

Highlighted
Contributor.
Contributor.

Re: Import operator list in assignment group

Jump to solution

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.

                                                                     

 

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.