Hi,
I have a case where I am testing a custom made report.
The report does nothing else but it copies some lines from one campaign to another. When I run action to run this report to copy lines it opens a request window where is possible to filter campaigns to copy lines from.
My question is how to manipulate TestRequestPage when running the test? For example, I would like to insert some value on the request page and regarding this value, the method will process on.
Here is a photo of my request window which runs before report: https://ibb.co/H4f32rC
Here as seen on the photo I would like to "insert" value for "Sales Code", but all in AL code.
I am using handler method to handle this event but I can't find any useful function for setting values in the request window.
[RequestPageHandler]
procedure B2C24_Req_Handler(var pRequestPage: TestRequestPage CopyPricesDiscFromCampaign)
begin
// what to do here with pRequestPage variable? How to set value for filter?
pRequestPage.OK().Invoke(); // submit filter
end;
If that's the case, you can directly use setfilter for "Sales Code" in Sales Price record variable and use settableview for the report as below.
Then in my request page handler, I just invoked the OK.
Hi Genie
thank you for your reply.
Something like this I wanted. :) But I think its the problem in the report dataset. For example, in your case, 'NoOfCopies' is a part of the dataset and its reachable. In my case in the dataset is only this:
dataset
{
dataitem(SalesPrice; "Sales Price")
{
DataItemTableView = sorting ("Sales Type", "Sales Code") where ("Sales Type" = filter ('Campaign'));
RequestFilterHeading = 'Filters';
RequestFilterFields = "Sales Code", "Item No.", "Variant Code", "Starting Date", "Ending Date";
trigger OnPreDataItem()
var
lcuSalesPrice: Codeunit SalesPrice;
lcuSalesLineDisc: Codeunit SalesLineDiscount;
begin
case oType of
oType::Price:
lcuSalesPrice.CopySalesPricesFromCampaign(SalesPrice, cCampaignNo);
oType::Discount:
lcuSalesLineDisc.CopyDiscountsFromCampaign(SalesPrice, cCampaignNo);
end;
end;
}
}
I can reach only 'SalesPrice' dataitem and this dataitem does not have function SetValue.
I would like to reach "Sales Code" in the request filter and set some value for it. Is this possible in my case?
Hi Gregor,
TestRequestPage variable will list all the request page variables & dataitems. Using that you can set values to your request page variables & filters to your data items.
In below screenshot, I have created a Request Page handler for "Purchase - Quote" report to set values for variables in Request Page.
André Arnaud de Cal... 291,965 Super User 2025 Season 1
Martin Dráb 230,779 Most Valuable Professional
nmaenpaa 101,156