Hi everyone,
I need to display the lot no details in Test report, I created a report extension
Thank you for the details i got it straight away from the data item i liked sales header and reservation entry instead of sales line.
Can you confirm which report ID you are using?
Thanks
You will not need the dataitem anymore if you go with this alternative, as long as you add the LotNo variable like so:
add("Sales Line")
{
column(Lot_No_1; LotNo)
{
}
}
Thanks for the response Sabina,
I cannot use add(Line) because its already available in standard report
I wrote a code same as yours in modify("Sales Line")
ReservationEntry.SetRange("Source Type", 37);
ReservationEntry.SetRange("Source ID", "Sales Line"."Document No.");
ReservationEntry.SetRange("Source Ref. No.", "Sales Line"."Line No.");
if ReservationEntry.FindSet() then begin
repeat
LotNo := ReservationEntry."Lot No.";
until ReservationEntry.next = 0;
Do we need both code and dataitem ?
Hi,
Since the Reservation entry is linked to a Sales line, and Sales Line has a composite key (meaning multiple fields form its key), you will need to link the Reservation entry by Source ID but also by Source Ref No (see below).
addlast("Sales Line")
{
dataitem("Reservation Entry"; "Reservation Entry")
{
DataItemLink = "Source ID" = FIELD("Document No."), "Source Ref No" = FIELD("Line No.");
column(Lot_No_1; "Lot No.")
{
}
}
}
Finally, on the report layout, you will need to create a new group underneath but inside your Sales Line group as you might have one or more Lots per sales line.
If you truly want an alternative, although less elegant, you can use a variable to store the lot numbers as 1 string of the reservation entries you iterate through with a loop. Make sure to reset this variable. You can also add a breakpoint if you want to debug this. See the code below:
dataset
{
add(Line)
{
column(Lot_No_1; LotNos)
{
}
}
modify(Line)
{
trigger OnAfterAfterGetRecord()
var
ResEntry: record "Reservation Entry";
begin
LotNos := '';
ResEntry.SetFilter("Source ID", Line."Document No.");
ResEntry.SetFilter("Source Ref. No.", format(Line."Line No."));
if ResEntry.findset() then
repeat
LotNos := LotNos + ResEntry."Lot No." + ", ";
until ResEntry.next()=0;
end;
}
}
var
LotNos: text;
Hope this helps!
Sabina
Developer at LIDD Consultants
Thanks for the response is there any alternate solution we have i mean by write a code in onaftergetrecord() trigger, i did that too by using finding the reservation entry table with sales line. i am able to retrieve records ,but the value is not updating in reports
Hi - Best to copy the report and create a new one on 50000 ID range. That will make your work easier and is straightforward. Let the community know if in case you need the steps to copy a default report and create a new one
Hope it helps
Do verify the answer by clicking "YES" for "Did this answer your question" - if it helped you, so that others can benefit out of it too. Thankyou very much for taking out time to read
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,219 Super User 2024 Season 2
Martin Dráb 230,056 Most Valuable Professional
nmaenpaa 101,156