Hi,

Recently we have a requirement of reading a .csv file from third party file server whose columns may jumble .I want to share my knowledge on this because I have recently seen some questions posted in forum asking a query how to handle a scenario when standard FCC is not fulfilling their requirement.

In sender communication channel use the below FCC .

FCC1.JPG

  I have used two mappings for achieving this requirement .

  Mapping 1:Splitting each record and passing the values to target structure without checking whether it belongs to that respective field or not .

Map1.JPG

I have used below udf for splitting each record and passing the values to target structure blindly.In case if any of the field is missing in any of the record this mapping gets failed and throws custom error notifying in which record the field is missing.

public void SplitbyComma(String[] BodyVal, ResultList Records, ResultList AcctEntryId, ResultList ValueDate, ResultList Entity, ResultList Folder, ResultList DenomCcy, ResultList FunctCcy, ResultList TradeId, ResultList TradeVersion, ResultList TradeType, ResultList LinkId, ResultList LinkVersion, ResultList Counterparty, ResultList AcctProcess, ResultList CashAccount, ResultList AcctEntryDescr, ResultList ReversesAcctEntryId, ResultList AcctEntrySubSysId, ResultList DenomCcyAmount, ResultList FunctCcyAmount, ResultList AcctRule, ResultList AcctChartAcctNumber, ResultList AcctChartDescr, ResultList AcctChartAlternateId, ResultList AcctCategory, ResultList IsParentAcct, ResultList ParentAcctChartAcctNumber, ResultList ParentAcctChartDescr, ResultList AcctChartType, ResultList EntityAltId1, ResultList EntityAltId2, ResultList EntityAltId3, ResultList EntityAltId4, ResultList EntityAltId5, ResultList CptyAltId1, ResultList CptyAltId2, ResultList CptyAltId3, ResultList CptyAltId4, ResultList CptyAltId5, ResultList FolderAltId1, ResultList FolderAltId2, ResultList FolderAltId3, ResultList FolderAltId4, ResultList FolderAltId5, ResultList TradeGroup, ResultList TradeAcctCode, ResultList TradeAcctCode2, ResultList CounterpartyTradeId, ResultList AlternateTradeId, ResultList TradeGroupAltId, ResultList TradeAcctCodeAltId, ResultList LinkGroup, ResultList LinkAcctCode, ResultList LinkAcctCode2, ResultList LinkGroupAltId, ResultList LinkAcctCodeAltId, ResultList AcctChartAltId1, ResultList AcctChartAltId2, ResultList AcctChartAltId3, ResultList AcctChartAltId4, ResultList AcctChartAltId5, ResultList ParentAcctChartAltId1, ResultList ParentAcctChartAltId2, ResultList ParentAcctChartAltId3, ResultList ParentAcctChartAltId4, ResultList ParentAcctChartAltId5, ResultList CashAccountAltID1, ResultList CashAccountAltID2, ResultList CashAccountAltID3, ResultList CashAccountAltID4, ResultList CashAccountAltID5, ResultList OriginalValueDate, ResultList ProductType, ResultList ProductSubType, ResultList AlternateLinkId, ResultList NoOfColumns, ResultList NoofRecords, Container container) throws StreamTransformationException{
AbstractTrace trace = container.getTrace(); //Trace container declaration
String[] ColNames =BodyVal[0].split(",");
int NoofCols =ColNames.length; //Calculating number of columns in file
int NoofRec = BodyVal.length; //Calculating number of records in file
NoOfColumns.addValue(Integer.toString(NoofCols));
NoofRecords.addValue(Integer.toString(NoofRec));
trace.addInfo("No of coloums : "+NoofCols);
trace.addInfo("No of records : "+NoofRecords);
for(int i=0,j=0 ;j< NoofRec ; j++) //By using string tokeniser ,splitting each body record and passing to target structure blindly without bothering about are we passing to apt fields
{
Records.addValue("1"); //Opening Records node for each record
String[] Rec = BodyVal[j].split(",");
trace.addInfo("Rec length  : "+Rec.length);
if (Rec.length == NoofCols )
{
AcctEntryId.addValue(Rec[i++]);
ValueDate.addValue(Rec[i++]);
Entity.addValue(Rec[i++]);
Folder.addValue(Rec[i++]);
DenomCcy.addValue(Rec[i++]);
FunctCcy.addValue(Rec[i++]);
TradeId.addValue(Rec[i++]);
TradeVersion.addValue(Rec[i++]);
TradeType.addValue(Rec[i++]);
LinkId.addValue(Rec[i++]);
LinkVersion.addValue(Rec[i++]);
Counterparty.addValue(Rec[i++]);
AcctProcess.addValue(Rec[i++]);
CashAccount.addValue(Rec[i++]);
AcctEntryDescr.addValue(Rec[i++]);
ReversesAcctEntryId.addValue(Rec[i++]);
AcctEntrySubSysId.addValue(Rec[i++]);
DenomCcyAmount.addValue(Rec[i++]);
FunctCcyAmount.addValue(Rec[i++]);
AcctRule.addValue(Rec[i++]);
AcctChartAcctNumber.addValue(Rec[i++]);
AcctChartDescr.addValue(Rec[i++]);
AcctChartAlternateId.addValue(Rec[i++]);
AcctCategory.addValue(Rec[i++]);
IsParentAcct.addValue(Rec[i++]);
ParentAcctChartAcctNumber.addValue(Rec[i++]);
ParentAcctChartDescr.addValue(Rec[i++]);
AcctChartType.addValue(Rec[i++]);
EntityAltId1.addValue(Rec[i++]);
EntityAltId2.addValue(Rec[i++]);
EntityAltId3.addValue(Rec[i++]);
EntityAltId4.addValue(Rec[i++]);
EntityAltId5.addValue(Rec[i++]);
CptyAltId1.addValue(Rec[i++]);
CptyAltId2.addValue(Rec[i++]);
CptyAltId3.addValue(Rec[i++]);
CptyAltId4.addValue(Rec[i++]);
CptyAltId5.addValue(Rec[i++]);
FolderAltId1.addValue(Rec[i++]);
FolderAltId2.addValue(Rec[i++]);
FolderAltId3.addValue(Rec[i++]);
FolderAltId4.addValue(Rec[i++]);
FolderAltId5.addValue(Rec[i++]);
TradeGroup.addValue(Rec[i++]);
TradeAcctCode.addValue(Rec[i++]);
TradeAcctCode2.addValue(Rec[i++]);
CounterpartyTradeId.addValue(Rec[i++]);
AlternateTradeId.addValue(Rec[i++]);
TradeGroupAltId.addValue(Rec[i++]);
TradeAcctCodeAltId.addValue(Rec[i++]);
LinkGroup.addValue(Rec[i++]);
LinkAcctCode.addValue(Rec[i++]);
LinkAcctCode2.addValue(Rec[i++]);
LinkGroupAltId.addValue(Rec[i++]);
LinkAcctCodeAltId.addValue(Rec[i++]);
AcctChartAltId1.addValue(Rec[i++]);
AcctChartAltId2.addValue(Rec[i++]);
AcctChartAltId3.addValue(Rec[i++]);
AcctChartAltId4.addValue(Rec[i++]);
AcctChartAltId5.addValue(Rec[i++]);
ParentAcctChartAltId1.addValue(Rec[i++]);
ParentAcctChartAltId2.addValue(Rec[i++]);
ParentAcctChartAltId3.addValue(Rec[i++]);
ParentAcctChartAltId4.addValue(Rec[i++]);
ParentAcctChartAltId5.addValue(Rec[i++]);
CashAccountAltID1.addValue(Rec[i++]);
CashAccountAltID2.addValue(Rec[i++]);
CashAccountAltID3.addValue(Rec[i++]);
CashAccountAltID4.addValue(Rec[i++]);
CashAccountAltID5.addValue(Rec[i++]);
OriginalValueDate.addValue(Rec[i++]);
ProductType.addValue(Rec[i++]);
ProductSubType.addValue(Rec[i++]);
AlternateLinkId.addValue(Rec[i++]);
i=0 ;
}
//Making the mapping fail when any of the field is missing in any of the record
else {throw new StreamTransformationException( " No of fields in " +j + "th record is not match to No of coloums .Please check the input file");  }
Rec = new String[0];
}
}






Mapping 2:To pass the values to apt fields in target structure

Map2.JPG

I have used the below udf for passing the values to apt fields in the target structure.


public void SplitbyColoumnName(String[] NoOfCol, String[] NoofRec, String[] Inp1, String[] Inp2, String[] Inp3, String[] Inp4, String[] Inp5, String[] Inp6, String[] Inp7, String[] Inp8, String[] Inp9, String[] Inp10, String[] Inp11, String[] Inp12, String[] Inp13, String[] Inp14, String[] Inp15, String[] Inp16, String[] Inp17, String[] Inp18, String[] Inp19, String[] Inp20, String[] Inp21, String[] Inp22, String[] Inp23, String[] Inp24, String[] Inp25, String[] Inp26, String[] Inp27, String[] Inp28, String[] Inp29, String[] Inp30, String[] Inp31, String[] Inp32, String[] Inp33, String[] Inp34, String[] Inp35, String[] Inp36, String[] Inp37, String[] Inp38, String[] Inp39, String[] Inp40, String[] Inp41, String[] Inp42, String[] Inp43, String[] Inp44, String[] Inp45, String[] Inp46, String[] Inp47, String[] Inp48, String[] Inp49, String[] Inp50, String[] Inp51, String[] Inp52, String[] Inp53, String[] Inp54, String[] Inp55, String[] Inp56, String[] Inp57, String[] Inp58, String[] Inp59, String[] Inp60, String[] Inp61, String[] Inp62, String[] Inp63, String[] Inp64, String[] Inp65, String[] Inp66, String[] Inp67, String[] Inp68, String[] Inp69, String[] Inp70, String[] Inp71, String[] Inp72, String[] Inp73, String[] Inp74, ResultList AcctEntryId, ResultList ValueDate, ResultList Entity, ResultList Folder, ResultList DenomCcy, ResultList FunctCcy, ResultList TradeId, ResultList TradeVersion, ResultList TradeType, ResultList LinkId, ResultList LinkVersion, ResultList Counterparty, ResultList AcctProcess, ResultList CashAccount, ResultList AcctEntryDescr, ResultList ReversesAcctEntryId, ResultList AcctEntrySubSysId, ResultList DenomCcyAmount, ResultList FunctCcyAmount, ResultList AcctRule, ResultList AcctChartAcctNumber, ResultList AcctChartDescr, ResultList AcctChartAlternateId, ResultList AcctCategory, ResultList IsParentAcct, ResultList ParentAcctChartAcctNumber, ResultList ParentAcctChartDescr, ResultList AcctChartType, ResultList EntityAltId1, ResultList EntityAltId2, ResultList EntityAltId3, ResultList EntityAltId4, ResultList EntityAltId5, ResultList CptyAltId1, ResultList CptyAltId2, ResultList CptyAltId3, ResultList CptyAltId4, ResultList CptyAltId5, ResultList FolderAltId1, ResultList FolderAltId2, ResultList FolderAltId3, ResultList FolderAltId4, ResultList FolderAltId5, ResultList TradeGroup, ResultList TradeAcctCode, ResultList TradeAcctCode2, ResultList CounterpartyTradeId, ResultList AlternateTradeId, ResultList TradeGroupAltId, ResultList TradeAcctCodeAltId, ResultList LinkGroup, ResultList LinkAcctCode, ResultList LinkAcctCode2, ResultList LinkGroupAltId, ResultList LinkAcctCodeAltId, ResultList AcctChartAltId1, ResultList AcctChartAltId2, ResultList AcctChartAltId3, ResultList AcctChartAltId4, ResultList AcctChartAltId5, ResultList ParentAcctChartAltId1, ResultList ParentAcctChartAltId2, ResultList ParentAcctChartAltId3, ResultList ParentAcctChartAltId4, ResultList ParentAcctChartAltId5, ResultList CashAccountAltID1, ResultList CashAccountAltID2, ResultList CashAccountAltID3, ResultList CashAccountAltID4, ResultList CashAccountAltID5, ResultList OriginalValueDate, ResultList ProductType, ResultList ProductSubType, ResultList AlternateLinkId, Container container) throws StreamTransformationException{
String[][] temp ;
AbstractTrace trace = container.getTrace(); //Trace container declaration
int Noofcols = Integer.parseInt(NoOfCol[0]); //No of columns
int NoofRecords = Integer.parseInt(NoofRec[0]); //No of rows
int counter =0;
int count = Noofcols * NoofRecords ;
temp = new String[NoofRecords][count];
for (int i = 0; i < NoofRecords; i++) {
temp[i][counter++] =Inp1[i] ;
temp[i][counter++] =Inp2[i] ;
temp[i][counter++] =Inp3[i] ;
temp[i][counter++] =Inp4[i] ;
temp[i][counter++] =Inp5[i] ;
temp[i][counter++] =Inp6[i] ;
temp[i][counter++] =Inp7[i] ;
temp[i][counter++] =Inp8[i] ;
temp[i][counter++] =Inp9[i] ;
temp[i][counter++] =Inp10[i] ;
temp[i][counter++] =Inp11[i] ;
temp[i][counter++] =Inp12[i] ;
temp[i][counter++] =Inp13[i] ;
temp[i][counter++] =Inp14[i] ;
temp[i][counter++] =Inp15[i] ;
temp[i][counter++] =Inp16[i] ;
temp[i][counter++] =Inp17[i] ;
temp[i][counter++] =Inp18[i] ;
temp[i][counter++] =Inp19[i] ;
temp[i][counter++] =Inp20[i] ;
temp[i][counter++] =Inp21[i] ;
temp[i][counter++] =Inp22[i] ;
temp[i][counter++] =Inp23[i] ;
temp[i][counter++] =Inp24[i] ;
temp[i][counter++] =Inp25[i] ;
temp[i][counter++] =Inp26[i] ;
temp[i][counter++] =Inp27[i] ;
temp[i][counter++] =Inp28[i] ;
temp[i][counter++] =Inp29[i] ;
temp[i][counter++] =Inp30[i] ;
temp[i][counter++] =Inp31[i] ;
temp[i][counter++] =Inp32[i] ;
temp[i][counter++] =Inp33[i] ;
temp[i][counter++] =Inp34[i] ;
temp[i][counter++] =Inp35[i] ;
temp[i][counter++] =Inp36[i] ;
temp[i][counter++] =Inp37[i] ;
temp[i][counter++] =Inp38[i] ;
temp[i][counter++] =Inp39[i] ;
temp[i][counter++] =Inp40[i] ;
temp[i][counter++] =Inp41[i] ;
temp[i][counter++] =Inp42[i] ;
temp[i][counter++] =Inp43[i] ;
temp[i][counter++] =Inp44[i] ;
temp[i][counter++] =Inp45[i] ;
temp[i][counter++] =Inp46[i] ;
temp[i][counter++] =Inp47[i] ;
temp[i][counter++] =Inp48[i] ;
temp[i][counter++] =Inp49[i] ;
temp[i][counter++] =Inp50[i] ;
temp[i][counter++] =Inp51[i] ;
temp[i][counter++] =Inp52[i] ;
temp[i][counter++] =Inp53[i] ;
temp[i][counter++] =Inp54[i] ;
temp[i][counter++] =Inp55[i] ;
temp[i][counter++] =Inp56[i] ;
temp[i][counter++] =Inp57[i] ;
temp[i][counter++] =Inp58[i] ;
temp[i][counter++] =Inp59[i] ;
temp[i][counter++] =Inp60[i] ;
temp[i][counter++] =Inp61[i] ;
temp[i][counter++] =Inp62[i] ;
temp[i][counter++] =Inp63[i] ;
temp[i][counter++] =Inp64[i] ;
temp[i][counter++] =Inp65[i] ;
temp[i][counter++] =Inp66[i] ;
temp[i][counter++] =Inp67[i] ;
temp[i][counter++] =Inp68[i] ;
temp[i][counter++] =Inp69[i] ;
temp[i][counter++] =Inp70[i] ;
temp[i][counter++] =Inp71[i] ;
temp[i][counter++] =Inp72[i] ;
temp[i][counter++] =Inp73[i] ;
temp[i][counter++] =Inp74[i] ;
counter =0 ;
}
for (int k=0,l = 0; l < Noofcols; l++) {
if (temp[k][l].equalsIgnoreCase("AcctEntryId") ||temp[k][l].equalsIgnoreCase("ValueDate") ||temp[k][l].equalsIgnoreCase("Entity") ||temp[k][l].equalsIgnoreCase("Folder") ||temp[k][l].equalsIgnoreCase("DenomCcy") ||temp[k][l].equalsIgnoreCase("FunctCcy") ||temp[k][l].equalsIgnoreCase("TradeId") ||temp[k][l].equalsIgnoreCase("TradeVersion") ||temp[k][l].equalsIgnoreCase("TradeType") ||temp[k][l].equalsIgnoreCase("LinkId") ||temp[k][l].equalsIgnoreCase("LinkVersion") ||temp[k][l].equalsIgnoreCase("Counterparty") ||temp[k][l].equalsIgnoreCase("AcctProcess") ||temp[k][l].equalsIgnoreCase("CashAccount") ||temp[k][l].equalsIgnoreCase("AcctEntryDescr") ||temp[k][l].equalsIgnoreCase("ReversesAcctEntryId") ||temp[k][l].equalsIgnoreCase("AcctEntrySubSysId") ||temp[k][l].equalsIgnoreCase("DenomCcyAmount") ||temp[k][l].equalsIgnoreCase("FunctCcyAmount")  ||temp[k][l].equalsIgnoreCase("AcctRule") ||temp[k][l].equalsIgnoreCase("AcctChartAcctNumber") ||temp[k][l].equalsIgnoreCase("AcctChartDescr") ||temp[k][l].equalsIgnoreCase("AcctChartAlternateId") ||temp[k][l].equalsIgnoreCase("AcctCategory") ||temp[k][l].equalsIgnoreCase("IsParentAcct") ||temp[k][l].equalsIgnoreCase("ParentAcctChartAcctNumber") ||temp[k][l].equalsIgnoreCase("ParentAcctChartDescr") ||temp[k][l].equalsIgnoreCase("AcctChartType") ||temp[k][l].equalsIgnoreCase("EntityAltId1") ||temp[k][l].equalsIgnoreCase("EntityAltId2") ||temp[k][l].equalsIgnoreCase("EntityAltId3") ||temp[k][l].equalsIgnoreCase("EntityAltId4") ||temp[k][l].equalsIgnoreCase("EntityAltId5") ||temp[k][l].equalsIgnoreCase("CptyAltId1") ||temp[k][l].equalsIgnoreCase("CptyAltId2") ||temp[k][l].equalsIgnoreCase("CptyAltId3") ||temp[k][l].equalsIgnoreCase("CptyAltId4") ||temp[k][l].equalsIgnoreCase("CptyAltId5") ||temp[k][l].equalsIgnoreCase("FolderAltId1") ||temp[k][l].equalsIgnoreCase("FolderAltId2") ||temp[k][l].equalsIgnoreCase("FolderAltId3") ||temp[k][l].equalsIgnoreCase("FolderAltId4") ||temp[k][l].equalsIgnoreCase("FolderAltId5") ||temp[k][l].equalsIgnoreCase("TradeGroup") ||temp[k][l].equalsIgnoreCase("TradeAcctCode") ||temp[k][l].equalsIgnoreCase("TradeAcctCode2") ||temp[k][l].equalsIgnoreCase("CounterpartyTradeId") ||temp[k][l].equalsIgnoreCase("AlternateTradeId") ||temp[k][l].equalsIgnoreCase("TradeGroupAltId") ||temp[k][l].equalsIgnoreCase("TradeAcctCodeAltId") ||temp[k][l].equalsIgnoreCase("LinkGroup") ||temp[k][l].equalsIgnoreCase("LinkAcctCode") ||temp[k][l].equalsIgnoreCase("LinkAcctCode2") ||temp[k][l].equalsIgnoreCase("LinkGroupAltId") ||temp[k][l].equalsIgnoreCase("LinkAcctCodeAltId") ||temp[k][l].equalsIgnoreCase("AcctChartAltId1") ||temp[k][l].equalsIgnoreCase("AcctChartAltId2") ||temp[k][l].equalsIgnoreCase("AcctChartAltId3") ||temp[k][l].equalsIgnoreCase("AcctChartAltId4") ||temp[k][l].equalsIgnoreCase("AcctChartAltId5") ||temp[k][l].equalsIgnoreCase("ParentAcctChartAltId1") ||temp[k][l].equalsIgnoreCase("ParentAcctChartAltId2") ||temp[k][l].equalsIgnoreCase("ParentAcctChartAltId3") ||temp[k][l].equalsIgnoreCase("ParentAcctChartAltId4") ||temp[k][l].equalsIgnoreCase("ParentAcctChartAltId5") ||temp[k][l].equalsIgnoreCase("CashAccountAltID1") ||temp[k][l].equalsIgnoreCase("CashAccountAltID2") ||temp[k][l].equalsIgnoreCase("CashAccountAltID3") ||temp[k][l].equalsIgnoreCase("CashAccountAltID4") ||temp[k][l].equalsIgnoreCase("CashAccountAltID5") ||temp[k][l].equalsIgnoreCase("OriginalValueDate") ||temp[k][l].equalsIgnoreCase("ProductType") ||temp[k][l].equalsIgnoreCase("ProductSubType") ||temp[k][l].equalsIgnoreCase("AlternateLinkId"))
{
if (temp[k][l].equalsIgnoreCase("AcctEntryId")){for(int m1 = 1; m1 < NoofRecords; m1++){ AcctEntryId.addValue(temp[m1][l]);}}
else if(temp[k][l].equalsIgnoreCase("ValueDate")){for(int m2 = 1; m2 < NoofRecords; m2++){ ValueDate.addValue(temp[m2][l]);}}
else if(temp[k][l].equalsIgnoreCase("Entity") ){for(int m3 = 1; m3 < NoofRecords; m3++){ Entity.addValue(temp[m3][l]);}}
else if (temp[k][l].equalsIgnoreCase("Folder") ){for(int m4 = 1; m4 < NoofRecords; m4++){ Folder.addValue(temp[m4][l]);}}
else if (temp[k][l].equalsIgnoreCase("DenomCcy") ){for(int m5 = 1; m5 < NoofRecords; m5++){ DenomCcy.addValue(temp[m5][l]);}}
else if (temp[k][l].equalsIgnoreCase("FunctCcy") ){for(int m6 = 1; m6 < NoofRecords; m6++){ FunctCcy.addValue(temp[m6][l]);}}
else if (temp[k][l].equalsIgnoreCase("TradeId") ){for(int m7 = 1; m7 < NoofRecords; m7++){ TradeId.addValue(temp[m7][l]);}}
else if (temp[k][l].equalsIgnoreCase("TradeVersion") ){for(int m8 = 1; m8 < NoofRecords; m8++){ TradeVersion.addValue(temp[m8][l]);}}
else if (temp[k][l].equalsIgnoreCase("TradeType") ){for(int m9 = 1; m9 < NoofRecords; m9++){ TradeType.addValue(temp[m9][l]);}}
else if (temp[k][l].equalsIgnoreCase("LinkId") ){for(int m10 = 1; m10 < NoofRecords; m10++){ LinkId.addValue(temp[m10][l]);}}
else if (temp[k][l].equalsIgnoreCase("LinkVersion") ){for(int m11 = 1; m11 < NoofRecords; m11++){ LinkVersion.addValue(temp[m11][l]);}}
else if (temp[k][l].equalsIgnoreCase("Counterparty") ){for(int m74 = 1; m74 < NoofRecords; m74++){ Counterparty.addValue(temp[m74][l]);}}
else if (temp[k][l].equalsIgnoreCase("AcctProcess") ){for(int m12 = 1; m12 < NoofRecords; m12++){ AcctProcess.addValue(temp[m12][l]);}}
else if (temp[k][l].equalsIgnoreCase("CashAccount") ){for(int m13 = 1; m13 < NoofRecords; m13++){ CashAccount.addValue(temp[m13][l]);}}
else if (temp[k][l].equalsIgnoreCase("AcctEntryDescr") ){for(int m14 = 1; m14 < NoofRecords; m14++){ AcctEntryDescr.addValue(temp[m14][l]);}}
else if (temp[k][l].equalsIgnoreCase("ReversesAcctEntryId") ){for(int m15 = 1; m15 < NoofRecords; m15++){ ReversesAcctEntryId.addValue(temp[m15][l]);}}
else if (temp[k][l].equalsIgnoreCase("AcctEntrySubSysId") ){for(int m16 = 1; m16 < NoofRecords; m16++){ AcctEntrySubSysId.addValue(temp[m16][l]);}}
else if (temp[k][l].equalsIgnoreCase("DenomCcyAmount") ){for(int m17 = 1; m17 < NoofRecords; m17++){ DenomCcyAmount.addValue(temp[m17][l]);}}
else if (temp[k][l].equalsIgnoreCase("FunctCcyAmount")  ){for(int m18 = 1; m18 < NoofRecords; m18++){ FunctCcyAmount.addValue(temp[m18][l]);}}
else if (temp[k][l].equalsIgnoreCase("AcctRule") ){for(int m19 = 1; m19 < NoofRecords; m19++){ AcctRule.addValue(temp[m19][l]);}}
else if (temp[k][l].equalsIgnoreCase("AcctChartAcctNumber") ){for(int m20 = 1; m20 < NoofRecords; m20++){ AcctChartAcctNumber.addValue(temp[m20][l]);}}
else if (temp[k][l].equalsIgnoreCase("AcctChartDescr") ){for(int m21 = 1; m21 < NoofRecords; m21++){ AcctChartDescr.addValue(temp[m21][l]);}}
else if (temp[k][l].equalsIgnoreCase("AcctChartAlternateId") ){for(int m22 = 1; m22 < NoofRecords; m22++){ AcctChartAlternateId.addValue(temp[m22][l]);}}
else if (temp[k][l].equalsIgnoreCase("AcctCategory") ){for(int m23 = 1; m23 < NoofRecords; m23++){ AcctCategory.addValue(temp[m23][l]);}}
else if (temp[k][l].equalsIgnoreCase("IsParentAcct") ){for(int m24 = 1; m24 < NoofRecords; m24++){ IsParentAcct.addValue(temp[m24][l]);}}
else if (temp[k][l].equalsIgnoreCase("ParentAcctChartAcctNumber") ){for(int m25 = 1; m25 < NoofRecords; m25++){ ParentAcctChartAcctNumber.addValue(temp[m25][l]);}}
else if (temp[k][l].equalsIgnoreCase("ParentAcctChartDescr") ){for(int m26 = 1; m26 < NoofRecords; m26++){ ParentAcctChartDescr.addValue(temp[m26][l]);}}
else if (temp[k][l].equalsIgnoreCase("AcctChartType") ){for(int m27 = 1; m27 < NoofRecords; m27++){ AcctChartType.addValue(temp[m27][l]);}}
else if (temp[k][l].equalsIgnoreCase("EntityAltId1") ){for(int m28 = 1; m28 < NoofRecords; m28++){ EntityAltId1.addValue(temp[m28][l]);}}
else if (temp[k][l].equalsIgnoreCase("EntityAltId2") ){for(int m29 = 1; m29 < NoofRecords; m29++){ EntityAltId2.addValue(temp[m29][l]);}}
else if (temp[k][l].equalsIgnoreCase("EntityAltId3") ){for(int m30 = 1; m30 < NoofRecords; m30++){ EntityAltId3.addValue(temp[m30][l]);}}
else if (temp[k][l].equalsIgnoreCase("EntityAltId4") ){for(int m31 = 1; m31 < NoofRecords; m31++){ EntityAltId4.addValue(temp[m31][l]);}}
else if (temp[k][l].equalsIgnoreCase("EntityAltId5") ){for(int m32 = 1; m32 < NoofRecords; m32++){EntityAltId5.addValue(temp[m32][l]);}}
else if (temp[k][l].equalsIgnoreCase("CptyAltId1") ){for(int m33 = 1; m33 < NoofRecords; m33++){CptyAltId1.addValue(temp[m33][l]);}}
else if (temp[k][l].equalsIgnoreCase("CptyAltId2") ){for(int m34 = 1; m34 < NoofRecords; m34++){ CptyAltId2.addValue(temp[m34][l]);}}
else if (temp[k][l].equalsIgnoreCase("CptyAltId3") ){for(int m35 = 1; m35 < NoofRecords; m35++){ CptyAltId3.addValue(temp[m35][l]);}}
else if (temp[k][l].equalsIgnoreCase("CptyAltId4") ){for(int m36 = 1; m36 < NoofRecords; m36++){ CptyAltId4.addValue(temp[m36][l]);}}
else if (temp[k][l].equalsIgnoreCase("CptyAltId5") ){for(int m37 = 1; m37 < NoofRecords; m37++){ CptyAltId5.addValue(temp[m37][l]);}}
else if (temp[k][l].equalsIgnoreCase("FolderAltId1") ){for(int m38 = 1; m38 < NoofRecords; m38++){ FolderAltId1.addValue(temp[m38][l]);}}
else if (temp[k][l].equalsIgnoreCase("FolderAltId2") ){for(int m39 = 1; m39 < NoofRecords; m39++){FolderAltId2.addValue(temp[m39][l]);}}
else if (temp[k][l].equalsIgnoreCase("FolderAltId3") ){for(int m40 = 1; m40 < NoofRecords; m40++){ FolderAltId3.addValue(temp[m40][l]);}}
else if (temp[k][l].equalsIgnoreCase("FolderAltId4") ){for(int m41 = 1; m41 < NoofRecords; m41++){ FolderAltId4.addValue(temp[m41][l]);}}
else if (temp[k][l].equalsIgnoreCase("FolderAltId5") ){for(int m42 = 1; m42 < NoofRecords; m42++){ FolderAltId5.addValue(temp[m42][l]);}}
else if (temp[k][l].equalsIgnoreCase("TradeGroup") ){for(int m43 = 1; m43 < NoofRecords; m43++){ TradeGroup.addValue(temp[m43][l]);}}
else if (temp[k][l].equalsIgnoreCase("TradeAcctCode") ){for(int m44 = 1; m44 < NoofRecords; m44++){ TradeAcctCode.addValue(temp[m44][l]);}}
else if (temp[k][l].equalsIgnoreCase("TradeAcctCode2") ){for(int m45 = 1; m45 < NoofRecords; m45++){ TradeAcctCode2.addValue(temp[m45][l]);}}
else if (temp[k][l].equalsIgnoreCase("CounterpartyTradeId") ){for(int m46 = 1; m46 < NoofRecords; m46++){ CounterpartyTradeId.addValue(temp[m46][l]);}}
else if (temp[k][l].equalsIgnoreCase("AlternateTradeId") ){for(int m47 = 1; m47 < NoofRecords; m47++){ AlternateTradeId.addValue(temp[m47][l]);}}
else if (temp[k][l].equalsIgnoreCase("TradeGroupAltId") ){for(int m48 = 1; m48 < NoofRecords; m48++){ TradeGroupAltId.addValue(temp[m48][l]);}}
else if (temp[k][l].equalsIgnoreCase("TradeAcctCodeAltId") ){for(int m49 = 1; m49 < NoofRecords; m49++){ TradeAcctCodeAltId.addValue(temp[m49][l]);}}
else if (temp[k][l].equalsIgnoreCase("LinkGroup") ){for(int m50 = 1; m50 < NoofRecords; m50++){LinkGroup.addValue(temp[m50][l]);}}
else if (temp[k][l].equalsIgnoreCase("LinkAcctCode") ){for(int m51 = 1; m51 < NoofRecords; m51++){LinkAcctCode.addValue(temp[m51][l]);}}
else if (temp[k][l].equalsIgnoreCase("LinkAcctCode2") ){for(int m52 = 1; m52 < NoofRecords; m52++){LinkAcctCode2.addValue(temp[m52][l]);}}
else if (temp[k][l].equalsIgnoreCase("LinkGroupAltId") ){for(int m53 = 1; m53 < NoofRecords; m53++){ LinkGroupAltId.addValue(temp[m53][l]);}}
else if (temp[k][l].equalsIgnoreCase("LinkAcctCodeAltId") ){for(int m54 = 1; m54 < NoofRecords; m54++){ LinkAcctCodeAltId.addValue(temp[m54][l]);}}
else if (temp[k][l].equalsIgnoreCase("AcctChartAltId1") ){for(int m55 = 1; m55 < NoofRecords; m55++){AcctChartAltId1.addValue(temp[m55][l]);}}
else if (temp[k][l].equalsIgnoreCase("AcctChartAltId2") ){for(int m56 = 1; m56< NoofRecords; m56++){ AcctChartAltId2.addValue(temp[m56][l]);}}
else if (temp[k][l].equalsIgnoreCase("AcctChartAltId3") ){for(int m57 = 1; m57 < NoofRecords; m57++){ AcctChartAltId3.addValue(temp[m57][l]);}}
else if (temp[k][l].equalsIgnoreCase("AcctChartAltId4") ){for(int m58 = 1; m58 < NoofRecords; m58++){AcctChartAltId4.addValue(temp[m58][l]);}}
else if (temp[k][l].equalsIgnoreCase("AcctChartAltId5") ){for(int m59 = 1; m59 < NoofRecords; m59++){AcctChartAltId5.addValue(temp[m59][l]);}}
else if (temp[k][l].equalsIgnoreCase("ParentAcctChartAltId1") ){for(int m60 = 1; m60 < NoofRecords; m60++){ ParentAcctChartAltId1.addValue(temp[m60][l]);}}
else if (temp[k][l].equalsIgnoreCase("ParentAcctChartAltId2") ){for(int m61 = 1; m61 < NoofRecords; m61++){ ParentAcctChartAltId2.addValue(temp[m61][l]);}}
else if (temp[k][l].equalsIgnoreCase("ParentAcctChartAltId3") ){for(int m62= 1; m62 < NoofRecords; m62++){ ParentAcctChartAltId3.addValue(temp[m62][l]);}}
else if (temp[k][l].equalsIgnoreCase("ParentAcctChartAltId4") ){for(int m63 = 1; m63 < NoofRecords; m63++){ ParentAcctChartAltId4.addValue(temp[m63][l]);}}
else if (temp[k][l].equalsIgnoreCase("ParentAcctChartAltId5") ){for(int m64 = 1; m64 < NoofRecords; m64++){ParentAcctChartAltId5.addValue(temp[m64][l]);}}
else if (temp[k][l].equalsIgnoreCase("CashAccountAltID1") ){for(int m65 = 1; m65 < NoofRecords; m65++){ CashAccountAltID1.addValue(temp[m65][l]);}}
else if (temp[k][l].equalsIgnoreCase("CashAccountAltID2") ){for(int m66 = 1; m66 < NoofRecords; m66++){CashAccountAltID2.addValue(temp[m66][l]);}}
else if (temp[k][l].equalsIgnoreCase("CashAccountAltID3") ){for(int m67 = 1; m67 < NoofRecords; m67++){ CashAccountAltID3.addValue(temp[m67][l]);}}
else if (temp[k][l].equalsIgnoreCase("CashAccountAltID4") ){for(int m68 = 1; m68 < NoofRecords; m68++){CashAccountAltID4.addValue(temp[m68][l]);}}
else if (temp[k][l].equalsIgnoreCase("CashAccountAltID5") ){for(int m69 = 1; m69 < NoofRecords; m69++){ CashAccountAltID5.addValue(temp[m69][l]);}}
else if (temp[k][l].equalsIgnoreCase("OriginalValueDate") ){for(int m70 = 1; m70 < NoofRecords; m70++){ OriginalValueDate.addValue(temp[m70][l]);}}
else if (temp[k][l].equalsIgnoreCase("ProductType") ){for(int m71 = 1; m71 < NoofRecords; m71++){ ProductType.addValue(temp[m71][l]);}}
else if (temp[k][l].equalsIgnoreCase("ProductSubType") ){for(int m72 = 1; m72 < NoofRecords; m72++){ ProductSubType.addValue(temp[m72][l]);}}
else {for(int m73 = 1; m73 < NoofRecords; m73++){ AlternateLinkId.addValue(temp[m73][l]);}}
}
else{
throw new StreamTransformationException( " Column name " + temp[k][l] + " in the file is not matching with our column names");
}
}//close brace for for loop
}





For better understanding and readability I’m providing testcases in Part2

To report this post you need to login first.

9 Comments

You must be Logged on to comment or reply to a post.

    1. Venkat Nimmagadda Post author

      Hi ,

      For example you have a csv file with columns A B C and first row/record tells you the column names,you have a requirement where in columns may jumble say B A C or C B A .

      Your PI server should be able to support even if the columns are jumbled .

      Can you go through part2 once .You will get clarity on this.Let me know if you are not clear with that

      Regards

      Venkat

      (0) 
      1. Iñaki Vila

        Hi Venkat,

        Thank you for your time, If i understand right you are saying that you can have:

        File 1

        ABC

        valueForA_11,valueForB_21,valueForC_31

        valueForA_12,valueForB_22,valueForC_32

        valueForA_13,valueForB_23,valueForC_33

        And in another file:

        File 2

        BAC

        valueForB_11,valueForA_21,valueForC_31

        valueForB_12,valueForA_22,valueForC_32

        valueForB_13,valueForA_23,valueForC_33

        am i Right?

        Regards.

        (0) 
        1. Venkat Nimmagadda Post author

          Yes, you are correct.

          File 1

          ABC

          valueForA_11,valueForB_21,valueForC_31

          valueForA_12,valueForB_22,valueForC_32

          valueForA_13,valueForB_23,valueForC_33

          And in another file:

          File 2

          BAC

          valueForB_21,valueForA_11,valueForC_31

          valueForB_22,valueForA_12,valueForC_32

          valueForB_23,valueForA_13,valueForC_33

          Regards

          Venkat

          (0) 

Leave a Reply