CSV file

rem *****************************************************************; rem * PeopleCode to Export Report CSV file *; rem *****************************************************************;
 Local Rowset &RS;
Local File &MYFILE;
Local SQL &SQL2;
Local string &Concat_Subject, &Subject, &Text;

Evaluate RECORD_AET.CAMPUS_EVENT_TYPE
When "EXAM" &Text = " examination registration at ";
When "SHRT"
When "LONG" &Text = " contact session registration at ";
End-Evaluate;

&MYFILE = GetFile("Contact_Reg_Venue_SMS.csv", "W");

If &MYFILE.IsOpen Then
&RS = CreateRowset(Record.MY_RECORD);
&RS.Fill("Where OPRID =:1 and RUN_CNTL_ID = :2", RECORD_AET.OPRID, RECORD_AET.RUN_CNTL_ID);

For &i = 1 To &RS.ActiveRowCount
&Concat_Subject = &RS(&i).MY_RECORD.SUBJECT1.Value | " " | &RS(&i).MY_RECORD.SUBJECT2.Value | " " | &RS(&i).MY_RECORD.SUBJECT3.Value | " " | &RS(&i).MY_RECORD.SUBJECT4.Value | " " | &RS(&i).MY_RECORD.SUBJECT5.Value | " " | &RS(&i).MY_RECORD.SUBJECT6.Value; &Subject = RTrim(&Concat_Subject);

 &MYFILE.WriteLine(&RS(&i).MY_RECORD.CELL_PHONE.Value | "," | &RS(&i).MY_RECORD.EMPLID.Value | ". We confirm your " | &RS(&i).MY_RECORD.DESCR.Value | &Text | &RS(&i).MY_RECORD.DESCR_LOCATION.Value | " for " | &Subject);

 End-For;
 End-If;
 &MYFILE.Close();

 rem 12345678. We confirm your June/July 2012 contact session registration at Polokwane, for SUBJECT1 SUBJECT2.; rem 12345678. We confirm your October 2012 examination registration at Polokwane, for SUBJECT1 SUBJECT2 ;

Comments