Hello.
I'm trying to make a report, packing list.
It has a filter "No.".
If the value of "Multi Document Package" of the record with the "No." is true,
then should list the combined orders in the same package, else list the record itself.
For the case in the below,
if filter "No." is P000130, then "Multi Document Package" value is true, so the report prints out "P000130-SO-0000508" and "P000130-SO-0000509", and their details.
If filter "No." is P000208, then "Multi Document Package" value is false, so the report print out "P000208" and its details.
I expected I can dynamically filter it in report page, but it looks not that simple.
Here is my code I expected it will work. But as you know, if statement is not allowed in dataitem.
if Multi_Document_Package then
DataItemLink = "Original Package No." = FIELD("No.");
else
DataItemLink = "No." = FIELD("No.");
Can someone give me an advise?
Thank you.
report 70705 "TRU Pckg No Packing Lst V2-T" { DefaultLayout = RDLC; RDLCLayout = './RDLC/LAX SalesOrderPackingList_70704_TruTest_v0.62.rdlc'; ApplicationArea = All; Caption = 'Pacakge Sales Orders Packing List V2 (TruTest)'; UsageCategory = ReportsAndAnalysis; dataset { dataitem(PackageFilter; "LAX Package") { RequestFilterFields = "No."; DataItemTableView = SORTING("Source Type", "Source Subtype", "Source ID") WHERE("Source Type" = CONST(36)); column(No_; "No.") { } column(Source_ID_; "Source ID") { } column(Multi_Document_No_; "Multi Document No.") { } column(Multi_Document_Package;"Multi Document Package") { } column(varIsMultiDocument;IsMultiDocument) { } dataitem(Package; "LAX Package") { if Multi_Document_Package then DataItemLink = "Original Package No." = FIELD("No."); else DataItemLink = "No." = FIELD("No."); //if Multi_Document_Package then // DataItemTableView = SORTING("Source Type", "Source Subtype", "Source ID") WHERE("Source Type" = CONST(36), "Original Package No." = CONST(FIELD("No."))); //else // DataItemTableView = SORTING("Source Type", "Source Subtype", "Source ID") WHERE("Source Type" = CONST(36), "Original Pa" = FILTER(FIELD("Multi Document No."))); PrintOnlyIfDetail = true; column(Package__Source_ID_; "Source ID") { } column(Package__No__; "No.") { } column(Package__Packing_Date_Caption; FieldCaption("Packing Date")) { } column(Package__Source_ID_Caption; FieldCaption("Source ID")) { } column(Package_Source_Subtype; "Source Subtype") { } dataitem("Package Line"; "LAX Package Line") { DataItemLink = "Package No." = FIELD("No."); DataItemTableView = SORTING("Package No.", "Line No.") WHERE("Quantity (Base)" = FILTER(> 0)); column(Package_Line_Type; Type) { } column(Package_Line__No__; "No.") { } column(Package_Line_Description; Description) { } column(Package_Line_Quantity; Quantity) { } column(Package_Line_Package_No_; "Package No.") { } column(Package_Line_Line_No_; "Line No.") { } } trigger OnAfterGetRecord() begin EShipFormatAddr.PackageShipTo(ShipToAddress, Package); end; } trigger OnAfterGetRecord() begin Package2.Reset; Package2.SetCurrentKey("No."); Package2.SetRange("No.", "No."); IsMultiDocument := Package2."Multi Document Package"; strMultiDocumentNos := Package2."Multi Document No."; end; } } requestpage { layout { } actions { } } labels { } var Package2: Record "LAX Package"; ShipToAddress: array[8] of Text[100]; PackageCount: Integer; Sales_Order_Packing_ListCaptionLbl: Label 'Sales Order Packing List'; CurrReport_PAGENOCaptionLbl: Label 'Page'; PackageCountCaptionLbl: Label 'Total Packages'; ShipToAddress_1_CaptionLbl: Label 'Ship-to'; UOMCaptionLbl: Label 'UOM'; Package_No_CaptionLbl: Label 'Package No.'; Closed_by_Packing_StationCaptionLbl: Label 'Closed by Packing Station'; EShipFormatAddr: Codeunit "LAX EShip Format Address"; IsMultiDocument: Boolean; strMultiDocumentNos: Text; }
Thank you guys. I will try your idea. That means I have to make a modification or a new RDLC, also. :_(
Hi, I agree with Damiano, unlike TableRelation Property, DataItemLink Property (Reports) does not support Conditions (If).
So in this case, you can create a new table and insert data when the Report is opened (such as OnPreReport (Report) Trigger), you can get different data according to the conditions in your code.
Then the report only needs to display the data. This will make the design of the report simpler.
Hope this helps as well.
Thanks.
ZHU
Hi mate! You can use a temporary table to print report what you want. On trigger OnPreDataItem, you can load a temporary table in different way if the multi_document_package var is true or false. Then you can use as dataitem the temporary table just load and then print it. Unfortunately there are some properties you can't valued dinamically. DataItemLink is one of these.
I hope I give you an idea for your report.
DZ
André Arnaud de Cal...
292,111
Super User 2025 Season 1
Martin Dráb
230,934
Most Valuable Professional
nmaenpaa
101,156