SHARE
TWEET

Untitled

a guest Mar 21st, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public  void UploadFileData()
  2.     {
  3.         AsciiStreamIo                                   file;
  4.         FileUploadTemporaryStorageResult                fileUpload;
  5.         fileUpload = File::GetFileFromUser() as FileUploadTemporaryStorageResult;
  6.         file = AsciiStreamIo::constructForRead(fileUpload.openResult());
  7.         if (file)
  8.         {
  9.             if (file.status())
  10.             {
  11.                 throw error("@SYS52680");
  12.             }
  13.             file.inFieldDelimiter(',');
  14.             file.inRecordDelimiter('\r\n');
  15.         }
  16.         container record;
  17.         while (!file.status())
  18.         {
  19.             record = file.read();
  20.             if (conLen(record))
  21.             {
  22.                 info(strFmt("%1 - %2",conPeek(record,1),conPeek(record,2)));
  23.                 str vehicleId       =   conPeek(record,1);
  24.                 str description     =   conPeek(record,2);
  25.                 FMTruck myNewVehicle = FMTruck::findOrCreate(vehicleId);
  26.                 myNewVehicle.Description = description;
  27.                 myNewVehicle.insert();
  28.             }
  29.         }
  30.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top