Hi there, I want to write a code for importing csv file to my form and my code is working, but the problem is, I want to update the form and check whether the importing files existed or not, if its exist then the data is updated, if its not, then it will be inserted into the form. my form should be like this and the FormOne should not have the same ID appear more than once, so I would use my unique field which is the ID
and my code is like this
private void importRunBaseBatch()
{
CommaTextIO textIO;
container c;
HeaderGrid HeaderGrid;
LineGrid LineGrid;
ImportRunBaseBatch importRunBaseBatch;
int i;
NoYes NoYes;
boolean first;
;
textIO = new CommaTextIo(path, "R");
textIO.inFieldDelimiter(",");
textIO.inRecordDelimiter("\r\n");
c = textIO.read();
while (textIO.status() == IO_Status::Ok)
{
if(first == false)
{
first = true;
c = textIO.read();
continue;
}
if(conLen(c) > 1)
{
HeaderGrid.clear();
HeaderGrid.FullName = conPeek(c,1);
HeaderGrid.ID = conPeek(c,2);
LineGrid.ID = conPeek(c,2);
LineGrid.Name1 = conPeek(c,3);
LineGrid.Name2 = conPeek(c,4);
HeaderGrid.insert();
LineGrid.insert();
a = HeaderGrid.ID;
}
i++;
c = textIO.read();
}
info(strFmt("%1 records imported.", i));
}
anyone has the idea how to solve this? very much thanks in advance