The below code is taking a csv file and looping through the rows, with each row it sets each column to a field name.If I hard code the field names in the loop it works very well
however if I try to use a field list and loop through the field list as it is looping through the CSV file rows it will not set the fields on the form
Can someone tell me what I am doing wrong PLEASE!
//Field List
int arrSize = 50;
String[] strFieldList;
strFieldList = new String[arrSize];
strFieldList[0] = "QAName";
strFieldList[1] = "DumbDumb1";
strFieldList[2] = "customercode";
strFieldList[3] = "customerEName";
strFieldList[4] = "priAdd";
strFieldList[5] = "priSecAdd";
strFieldList[6] = "pricity";
strFieldList[7] = "pristate";
strFieldList[8] = "prizip";
strFieldList[9] = "pricountry";
strFieldList[10] = "DumbDumb2";
strFieldList[11] = "contact";
strFieldList[12] = "DumbDumb3";
strFieldList[13] = "DumbDumb4";
strFieldList[14] = "DumbDumb5";
strFieldList[15] = "DumbDumb6";
strFieldList[16] = "priPhone";
//Loop through Row
for(startInd = -1, endInd = 0; endInd >= 0; )
{
lnDoc = db.createDocument();
lnDoc.replaceItemValue("Form", "Customer");
endInd = line.indexOf(FieldSeparator,startInd + 1);
if (endInd < 1)
{
//Last Column Value
record.add(line.substring(startInd + 1,len));
System.out.println(strFieldList[intFieldCount] + " ==> " + "Field Count: " + intFieldCount + " : " + line.substring(startInd + 1,endInd));
lnDoc.replaceItemValue(strFieldList[intFieldCount], String.valueOf(line.substring(startInd + 1,endInd)));
}
else
{
//Column Values
record.add(line.substring(startInd + 1,endInd));
lnDoc.replaceItemValue(strFieldList[intFieldCount], String.valueOf(line.substring(startInd + 1,endInd)));
}
startInd = endInd;
intFieldCount = intFieldCount + 1;
}
System.out.println(" ");
lnDoc.save(true, false);
lnDoc.recycle();