Local File &MYFILE;
Local array of string &ARRAY;
Local Record &REC;
Local Rowset &studentList ;
&studentList = GetLevel0()(1).GetRowset(Scroll.L_TRNS_CRSE_TBL);
&REC = CreateRecord(Record.L_TRNSCRS_FILE);
SQLExec("SELECT ATTACHSYSFILENAME FROM PS_L_TRNS_CRS_ATCH WHERE OPRID =:1 AND RUN_CNTL_ID=:2", %UserId, L_TRNS_CRS_ATCH.RUN_CNTL_ID.Value, &FileName);
rem Messagebox(0,"",0,0,""|&FileName);
&SQL = CreateSQL("%SelectAll(:2) WHERE ATTACHSYSFILENAME =:1 ", &FileName, Record.L_TRNSCRS_FILE);
While &SQL.Fetch(&REC)
&FILE1 = GetFile(&FileName, "w", "a", %FilePath_Absolute);
rem Messagebox(0,"",0,0, " | %FilePath_Absolute | "File Open:" | &FILE1.IsOpen);
If &FILE1.IsOpen Then
try
&FILE1.WriteRaw(&REC.FILE_DATA.Value);
&FILE1.Close();
catch Exception &ex2
throw CreateException(0, 0, "Unable to write file: " | &ex2.ToString());
end-try;
End-If;
End-While;
&MYFILE = GetFile(&FileName, "r", "a", %FilePath_Absolute);
&ARRAY = CreateArrayRept("", 0);
rem MessageBox(0, "", 0, 0, "" | &MYFILE.IsOpen);
If &MYFILE.IsOpen Then
If &MYFILE.SetFileLayout(FileLayout.L_TRNS_CRSE_MNL_FL) Then
While &MYFILE.ReadLine(&STRING);
&ARRAY = Split(&STRING, ",");
For &i = 1 To &ARRAY.Len
MessageBox(0, "", 0, 0, "" | ("Value of &ARRAY[" | &i | "]: " | &ARRAY [&i]));
End-For;
End-while;
end-if;
end-if;
No comments:
Post a Comment