Hello everyone,
can someone explain to me why standard reports use integer tables to display the text from BLOB fields. Such as the work description in sales quotes:
report 1304 "Standard Sales - Quote" { ... dataset { dataitem(Header; "Sales Header") { ... dataitem(WorkDescriptionLines; "Integer") { DataItemTableView = SORTING(Number) WHERE(Number = FILTER(1 .. 99999)); column(WorkDescriptionLineNumber; Number) { } column(WorkDescriptionLine; WorkDescriptionLine) { } trigger OnAfterGetRecord() begin if WorkDescriptionInstream.EOS then CurrReport.Break(); WorkDescriptionInstream.ReadText(WorkDescriptionLine); end; trigger OnPostDataItem() begin Clear(WorkDescriptionInstream) end; trigger OnPreDataItem() begin if not ShowWorkDescription then CurrReport.Break(); Header."Work Description".CreateInStream(WorkDescriptionInstream, TEXTENCODING::UTF8); end; } ... trigger OnAfterGetRecord() begin ... CalcFields("Work Description"); ShowWorkDescription := "Work Description".HasValue; ... end; } } ... var WorkDescriptionInstream: InStream; WorkDescriptionLine: Text; ShowWorkDescription: Boolean; ... }
Why not just use the Sales Header's GetWorkDescription function, like the card page does:
report 1304 "Standard Sales - Quote" { ... dataset { dataitem(Header; "Sales Header") { ... column(WorkDescription; Header.GetWorkDescription()) { } ... } } ... }
I would be interested to know what advantages you (or Microsoft) see in the first variant. Or what disadvantages I overlook in my proposal.
Thank you for your help and best regards
Nico
Hi, I agree with Rahul, there is nothing wrong with the second method.
And the following is a brief introduction about Integer Dataitems, hoping to give some hints.
http://harikiran-in-nav.blogspot.com/2020/01/why-and-when-do-we-need-to-use-integer.html
Thanks
ZHU
If the method you described is giving you the desired result then go for it. There can be multiple ways to reach a destination, with each having it's own pros & cons. To the best of my understanding, not just this instance, but Microsoft uses a lot of Integer in a lot of reports. It can be due to a handful of reasons:
1. Probably a report is carried forward/migrated from the earliest of NAV days - I am talking about 1990's. Yes such reports exist, in which the design of the overall report has not changed but minor tweaks have been added. Probably in those early days of C/AL the best way to retrieve such records was only through the Integer dataitem, so it has been used till date. You ask why? - You don't change the code until it works!
2. Many a times, Microsoft keeps in mind efficiency to the top most. In your code, the result will appear 2 seconds later than what Microsoft has written, probably not! But largely, the purpose of MS using integers is to loop through dataitems really quickly as unlike other dataitems, integers don't have any additional columns to deal with when reading a table, it just skims fast giving the report a "feel" of iterating through a table record without actually doing so
Other community members may also chime in with their views, however the real reason behind the design may stay mystery
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,113 Super User 2024 Season 2
Martin Dráb 229,918 Most Valuable Professional
nmaenpaa 101,156