Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi members, in a big project, I have to map two fields correctly from the input to output:
- The first field in the output is named "attribute_PSS_Comment" and it contains the concatenation of three fields from the input which are: "attribute_FPDMISBGCOMMENT_1", "attribute_FPDMISBGCOMMENT_2" and "attribute_PSS_FPDM_POC_Recommended_Family".
- The second field in the output is named "attribute_PSS_SAPDescription" and it is mapped with "attribute_FPDMSAPDescription" of the input. The "attribute_FPDMSAPDescription" is also mapped with "attribute_PSS_ManufacturingItemExt_PSS_FaureciaShortLengthDescriptionFCS" in the output.
The creation of the fields is done in the component "tJavaRow_15" as following:
Field attributes = output_row.getClass().getDeclaredField("attributes");
Field attributes1 = output_row.getClass().getDeclaredField("attributes1");
//if(!(String.valueOf(input_row.getClass().getField("name").get(input_row))).startsWith("CM-")){
Set<String> set1=((Map<String,String>)globalMap.get("colHeaderMaterialBO")).keySet();
//System.out.println("OKKKKK" + (Map<String,String>)globalMap.get("colHeaderMaterialBO"));
boolean first = true;
int index = 12;
String concat="";
String concat1="";
for(String str:set1){
String cellName = str ;
String cellValue = (input_row.getClass().getField(((Map<String,String>)globalMap.get("colHeaderMaterialBO")).get(cellName)).get(input_row).toString());
// System.out.println(((String)globalMap.get("tFileList_5_CURRENT_FILEPATH"))+"\n"+cellName + "-> "+cellValue);
if(cellName.equals("attribute_FPDMISBGCOMMENT_1") || cellName.equals("attribute_FPDMISBGCOMMENT_2") || cellName.equals("attribute_PSS_FPDM_POC_Recommended_Family")){
if ("".equalsIgnoreCase(concat)){
concat = cellValue;
}else{
if (!("".equals(cellValue))){
concat = concat +" - "+ cellValue;
}
}
}
if(cellName.equals("attribute_FPDMSAPDescription")){
if ("".equalsIgnoreCase(concat1)){
concat1 = cellValue;
}else{
if (!("".equals(cellValue))){
concat1 = concat1 +" - "+ cellValue;
}
}
}
try {
Field out=output_row.getClass().getDeclaredField(cellName);
if(cellName.equals("key")){
out.set(output_row, Integer.parseInt(cellValue));
}
else {
out.set(output_row, cellValue);
}
} catch (NoSuchFieldException nsfe) {
Field fld = output_row.getClass().getDeclaredField("newColumn"+index);
fld.set(output_row, cellValue);
index++;
}
}
//}
if (concat.length()>=40){
attributes.set(output_row,""+concat.substring(0, 40));
}else{
attributes.set(output_row,""+concat);
}
if (concat1.length()>=40){
attributes1.set(output_row,""+concat1.substring(0, 40));
}else{
attributes1.set(output_row,""+concat1);
}
and in the following tMap named tMap_7, the mapping id done as following: