class HSImportCSVFile
{
public static void main(Args _args)
{
FileUploadTemporaryStorageResult importFile;
container record;
importFile = File::GetFileFromUser(classStr(FileUploadTemporaryStorageStrategy));
if(importFile && importFile.getUploadStatus())
{
CommaStreamIo io = CommaStreamIo::constructForRead(importFile.openResult());
if (io)
{
if (io.status())
throw error('@SYS52680');
io.inFieldDelimiter(',');
io.inRecordDelimiter('\r\n');
}
while (!io.status())
{
record = io.read();
if (conLen(record))
{
info(strFmt("%1 - %2 - %3 - %4", conPeek(record, 1), conPeek(record, 2), conPeek(record, 3), conPeek(record, 4)));
}
}
}
}
}
{
public static void main(Args _args)
{
FileUploadTemporaryStorageResult importFile;
container record;
importFile = File::GetFileFromUser(classStr(FileUploadTemporaryStorageStrategy));
if(importFile && importFile.getUploadStatus())
{
CommaStreamIo io = CommaStreamIo::constructForRead(importFile.openResult());
if (io)
{
if (io.status())
throw error('@SYS52680');
io.inFieldDelimiter(',');
io.inRecordDelimiter('\r\n');
}
while (!io.status())
{
record = io.read();
if (conLen(record))
{
info(strFmt("%1 - %2 - %3 - %4", conPeek(record, 1), conPeek(record, 2), conPeek(record, 3), conPeek(record, 4)));
}
}
}
}
}
No comments:
Post a Comment