Hello Experts,
Need Your help for a logic,
I have two input structures (merged) - one with the Record nodes and other one is used for lookup which has Company code & Network IDs.
Logic - Lookup is done on //Record/CompCodes/CompanyCode and //select_response/row/Child_Company_Code
If both of the above values match, then return the respective //select_response/row/Child_Node_Network
(Network IDs can be duplicate)


I am able to lookup the Network IDs but not able to manage the Context and break the output in separate nodes.
CPI Input - cpi-second-map-input-multiple-company-codes.xml
Wrong Output - cpi-wrong-output-giving-only-1-company-code.xml
Desired output - cpi-second-map-output-multiple-company-codes.xml
-------------------------------------------------------------------------------------------------------------------------------------------------
Groovy Script I have used -
import com.sap.it.api.mapping.*;
def void lookup(String[] Parent_Company_Code, String[] Child_Company_Code, String[] Child_Node_Network, Output output, MappingContext context) {
String a = "";
for(int i=0; i<Parent_Company_Code.length; i++) {
for(int j=0; j<Child_Company_Code.length; j++) {
if(Parent_Company_Code[i] == null || Child_Company_Code[j] == null)
continue;
if(Parent_Company_Code[i].equals(Child_Company_Code[j])) {
a = Child_Node_Network[j];
//break;
output.addValue(a);
}
}
}
//output.addValue(a);
}
-------------------------------------------------------------------------------------------------------------------------------------------------
Thanks,
Akshay