Thursday, 12 August 2021

Remove duplicates in the mapping groovy script

Remove duplicates from the input field and place in a array and return the fields values.



Groovy Script:

import com.sap.it.api.mapping.*;


def void customFunc(String[] a, Output result){

def Prod = []

Prod[0]=a[0]

result.addValue(a[0])

for(int i=1; i<a.length; i++){

if(Prod.contains(a[i]))

continue;

else{

Prod.add(a[i]);

result.addValue(a[i]);

}
}
}




No comments:

Post a Comment