Hello guys,
I have developed code to test the App through test tool, Here I'm trying to develop code to download/Save multiple reports while Microsoft User runs the Test tool, So that user can see that reports are running successfully.
But i have an issue here in the following code. when i ran the test tool it is only saving the
last report i,e RunItemLabel4x6Report and if we comment the last procedures then it is downloading
the first report i,e RunItemLabel2x3Report.
I'm thinking that it is overriding the reports while saving
another issue is--> it is saved into downloads folder instead of saving into the path i mentioned below.
Is there any solution for this issue?
Thanks in advance!!!
codeunit 50001 "Testing App"
{
Subtype = Test;
[Test]
procedure RunItemLabels2x3Report()
var
ItemLbl2x3RPT: Report "Item label 2x3 inch";
ItemL: record Item;
outstreamL: outstream;
InstreamL: Instream;
tempblob: Record TempBlob temporary;
Param: Text;
Uploaded: Boolean;
filename: text;
Recref: RecordRef;
begin
begin
ItemL.reset;
ItemL.FindFirst();
ItemL.setrange("No.", ItemL."No.");
ItemL.SetFilter("Common Item No.", '<>%1', '');
ItemL.FindFirst();
clear(ItemLbl2x3RPT);
tempblob.init;
tempblob.blob.CreateOutStream(OutstreamL);
tempblob.blob.CreateInStream(InstreamL);
Recref.GetTable(ItemL);
if ItemLbl2x3RPT.SaveAs(Param, ReportFormat::Pdf, outstreamL, Recref) then
//message('saved');
filename := 'Item Label 2x3 Report.pdf';
DownloadFromStream(InstreamL, 'Report Output', 'C:\Temp2\', 'All Files (*.*)|*.*', filename);
end;
end;
[Test]
procedure RunItemLabels3x3Report()
var
ItemLbl3x3RPT: Report "Item Label 3x3 inch";
ItemL1: record Item;
outstreamL: outstream;
InstreamL: Instream;
tempblob: Record TempBlob temporary;
Param: Text;
Uploaded: Boolean;
filename: text;
Recref: RecordRef;
begin
ItemL1.reset;
ItemL1.FindFirst();
ItemL1.setrange("No.", ItemL1."No.");
ItemL1.SetFilter("Common Item No.", '<>%1', '');
ItemL1.FindFirst();
clear(ItemLbl3x3RPT);
Clear(Recref);
tempblob.init;
tempblob.blob.CreateOutStream(OutstreamL);
tempblob.blob.CreateInStream(InstreamL);
Recref.GetTable(ItemL1);
if ItemLbl3x3RPT.SaveAs(Param, ReportFormat::Pdf, outstreamL, Recref) then
//message('saved');
filename := 'Item Label 3x3 Report.pdf';
DownloadFromStream(InstreamL, 'Report Output', 'C:\Temp2\', 'All Files (*.*)|*.*', filename);
end;
[Test]
procedure RunItemLabels4x6Report()
var
ItemLbl4x6RPT: Report "Item Label 4x6 inch";
ItemL2: record Item;
outstreamL: outstream;
InstreamL: Instream;
tempblob: Record TempBlob temporary;
Param: Text;
Uploaded: Boolean;
filename: text;
Recref: RecordRef;
begin
ItemL2.reset;
ItemL2.FindFirst();
ItemL2.setrange("No.", ItemL2."No.");
ItemL2.SetFilter("Common Item No.", '<>%1', '');
ItemL2.FindFirst();
clear(ItemLbl4x6RPT);
tempblob.init;
tempblob.blob.CreateOutStream(OutstreamL);
tempblob.blob.CreateInStream(InstreamL);
Recref.GetTable(ItemL2);
if ItemLbl4x6RPT.SaveAs(Param, ReportFormat::Pdf, outstreamL, Recref) then
//message('saved');
filename := 'Item Label 4x6 Report.pdf';
DownloadFromStream(InstreamL, 'Report Output', 'C:\Temp2\', 'All Files (*.*)|*.*', filename);
end;

Report
All responses (
Answers (