Creating a File Layout.
- Create or Select a Record for your data. I used a view, to avoid having to deal with joins in PeopleCode.
- Create a File Layout Definition.
- Create an Application Engine Program, with a tiny bit of code in it.
- Stuff all these things into a project so you can maintain your sanity at a later time.
Local Record &Rec;
Local File &File;
Local SQL &SQL;
&File = GetFile("c:\temp\export_sample.xml", "W",
%FilePath_Absolute);
If &File.IsOpen Then
If &File.SetFileLayout(FileLayout.YOUR_FILE_LAYOUT_DEFINITION) Then
&Rec = CreateRecord(Record.YOUR_RECORD_DEFINITION);
&SQL = CreateSQL("%Selectall(:1)", &Rec);
While &SQL.Fetch(&Rec)
&File.WriteRecord(&Rec);
&File.WriteLine("</YOUR_RECORD_DEFINITION>");
End-While;
Else
Error ("File Layout Not Correct");
End-If;
Else
Error ("file not open");
End-If;
&File.Close();
No comments:
Post a Comment