上傳CSV FILE 及在CSV FILE 內找回資料 :

           #File

           container               record;
            int                     totalOfLines;
            CommaTextStreamIo       localStream;
            Num                     number;
            

           //上傳CSV FILE
            fileUpload = File::GetFileFromUser() as FileUploadTemporaryStorageResult;
            str textFile = fileUpload.getDownloadUrl();
            localStream = CommaTextStreamIo::constructForRead(File::UseFileFromURL(textFile));

            if (localStream.status() != IO_Status::Ok)
            {
                throw error(strfmt('Is not possible to open the file. Error %1',enum2str(localStream.status())));
            }

// 在CSV FILE 內找回資料

            localStream.inFieldDelimiter("\,");
            localStream.inRecordDelimiter("\n");

            record = localStream.read();  // CSV 內資料

            if(conlen(record) == 1)
            {
                throw error('Is not possible to import the file, incorrect format');
            }

arrow
arrow
    全站熱搜

    lionlionchopper 發表在 痞客邦 留言(0) 人氣()