class HSGenerateCSVFile
{
public static void main(Args _args)
{
CommaStreamIo io = CommaStreamIo::constructForWrite();
System.IO.Stream stream;
System.IO.StreamReader sReader;
str fileName = 'Vendors.csv';
str fileContent;
VendTable vendTable;
// Write header
io.writeExp(['Account number', 'name', 'Currency', 'Vendor group']);
// Write line
while select vendTable
where vendTable.DataAreaId == 'USMF'
{
io.writeExp([vendTable.AccountNum,vendTable.name(),vendTable.Currency,vendTable.VendGroup]);
}
// Set stream
stream = io.getStream();
stream.Position = 0;
// Set stream reader
sReader = new System.IO.StreamReader(stream);
// Set file contentn string
fileContent = sReader.ReadToEnd();
// Save file
File::SendStringAsFileToUser(fileContent, fileName);
}
}
{
public static void main(Args _args)
{
CommaStreamIo io = CommaStreamIo::constructForWrite();
System.IO.Stream stream;
System.IO.StreamReader sReader;
str fileName = 'Vendors.csv';
str fileContent;
VendTable vendTable;
// Write header
io.writeExp(['Account number', 'name', 'Currency', 'Vendor group']);
// Write line
while select vendTable
where vendTable.DataAreaId == 'USMF'
{
io.writeExp([vendTable.AccountNum,vendTable.name(),vendTable.Currency,vendTable.VendGroup]);
}
// Set stream
stream = io.getStream();
stream.Position = 0;
// Set stream reader
sReader = new System.IO.StreamReader(stream);
// Set file contentn string
fileContent = sReader.ReadToEnd();
// Save file
File::SendStringAsFileToUser(fileContent, fileName);
}
}
No comments:
Post a Comment