Need to add Location Code to Sales Shipment report but the Sales Shipment Line is temp dataitem, is there a way to add the column using report extension?
First let see if I understand what you are trying to do: When processing a DataItem based on a temporary record you need to include additional columns to print data from the related physical record. The problem being that the report extension only has access the columns that were included in this DataItem from the base report. I also suspect those included columns are not sufficient to retrieve the related record.
How to solve:
1. When processing the DataItem for the physical record, save each record to a temporary table.
2. When processing the DataItem for the temp table, retrieve the physical record from your new temporary table and set you new columns as needed.
Example Code (Step 1)
modify("Sales Invoice Line")
{
trigger OnAfterAfterGetRecord()
begin
TempSalesInvoiceLine2 := "Sales Invoice Line";
TempSalesInvoiceLine2.Insert();
end;
}
Example Code (Step 2)
modify(SalesInvLine)
{
trigger OnAfterPreDataItem()
begin
NumberOfLines2 := TempSalesInvoiceLine2.Count;
OnLineNumber2 := 0;
end;
trigger OnAfterAfterGetRecord()
begin
CommentDesc := '';
if OnLineNumber2 < NumberOfLines2 then begin
OnLineNumber2 := OnLineNumber2 + 1;
if OnLineNumber2 = 1 then
TempSalesInvoiceLine2.Find('-')
else
TempSalesInvoiceLine2.Next;
Answers
How to solve:
1. When processing the DataItem for the physical record, save each record to a temporary table.
2. When processing the DataItem for the temp table, retrieve the physical record from your new temporary table and set you new columns as needed.
Example Code (Step 1)
modify("Sales Invoice Line")
{
trigger OnAfterAfterGetRecord()
begin
TempSalesInvoiceLine2 := "Sales Invoice Line";
TempSalesInvoiceLine2.Insert();
end;
}
Example Code (Step 2)
modify(SalesInvLine)
{
trigger OnAfterPreDataItem()
begin
NumberOfLines2 := TempSalesInvoiceLine2.Count;
OnLineNumber2 := 0;
end;
trigger OnAfterAfterGetRecord()
begin
CommentDesc := '';
if OnLineNumber2 < NumberOfLines2 then begin
OnLineNumber2 := OnLineNumber2 + 1;
if OnLineNumber2 = 1 then
TempSalesInvoiceLine2.Find('-')
else
TempSalesInvoiceLine2.Next;