I created a custom report in BC, information is obtained in the header, however I cannot obtain the records for the lines. I have already confirmed within Microsoft Report Builder that there is no visibility condition, so I think the problem is in the .al code but I have not been able to detect the error.
I share my code that I have developed:
report 50400 /Transform Bobina/
{
DefaultLayout = RDLC;
RDLCLayout = './src/report/design/Transform Bobina.rdl';
Caption = 'Transform Bobina';
dataset
{
dataitem(/Bobina Transformacion Header/; /Bobina Transformacion Header/)
{
DataItemTableView = sorting(/No./);
RequestFilterHeading = 'Ped. transform. Bobina';
RequestFilterFields = /No./;
column(No_TransferHdr; /No./)
{
}
column(ItemNo_BobinaTransformacionHeader; /Bobina Transformacion Header/./Item No./)
{
}
column(Description_BobinaTransformacionHeader; /Bobina Transformacion Header/.Description)
{
}
column(Quantity_BobinaTransformacionHeader; /Bobina Transformacion Header/.Quantity)
{
}
dataitem(CopyLoop; Integer)
{
DataItemTableView = sorting(Number);
DataItemLinkReference = /Bobina Transformacion Header/;
dataitem(PageLoop; Integer)
{
DataItemTableView = sorting(Number) where(Number = const(1));
DataItemLinkReference = CopyLoop;
column(CopyCaption; StrSubstNo(Text000, CopyText))
{
}
column(PostingDate_TransHdr; Format(/Bobina Transformacion Header/./Posting Date/, 0, 4))
{
}
column(PageCaption; StrSubstNo(Text002, ''))
{
}
column(OutputNo; OutputNo)
{
}
column(ShptMethodDesc; ShipmentMethod.Description)
{
}
dataitem(/Bobina Transformacion Line/; /Bobina Transformacion Line/)
{
DataItemTableView = sorting(/Document No./, /Line No./) where(Quantity = filter(<> 0));
DataItemLinkReference = /Bobina Transformacion Header/;
DataItemLink = /Document No./ = field(/No./);
column(LineNo_TransLine; /Line No./)
{
}
}
}
trigger OnPreDataItem()
begin
NoOfLoops := Abs(NoOfCopies) + 1;
CopyText := '';
SetRange(Number, 1, NoOfCopies);
OutputNo := 1;
end;
trigger OnAfterGetRecord()
begin
if Number > 1 then begin
CopyText := Text000;
OutputNo += 1;
end;
end;
}
}
}
var
ShipmentMethod: Record /Shipment Method/;
DimSetEntry1: Record /Dimension Set Entry/;
DimSetEntry2: Record /Dimension Set Entry/;
FormatAddr: Codeunit /Format Address/;
TransferFromAddr: Text[50];
TransferToAddr: Text[50];
NoOfCopies: Integer;
NoOfLoops: Integer;
CopyText: Text[30];
DimText: Text[120];
OldDimText: Text[75];
ShowInternalInfo: Boolean;
Continue: Boolean;
OutputNo: Integer;
Text000: Label 'COPIA';
Text001: Label 'Ped. transfer. %1';
Text002: label 'Pág. %1';
}
Thanks in advance for the help