web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested answer

Report looping questions

(0) ShareShare
ReportReport
Posted on by

Hello everyone,

I've got several question regarding some code that I'm trying to analyze. I've tried looking on the web for those answers but no success. I'm a junior BC developer, I might say some stupid things.

pastedimage1626350686865v2.png

1. For the first DataItem in the Dataset, Purchase Receipt Header, why is there a DataItemTableView = Sorting(No.):?

Is it just used to sort the data after the code? Just for looping purposes to look better in the report?

2. I've learned that in a report, if you need to send things only ONCE to the report ( date, company picture, company name, etc) you need to use an Integer DataItem with this following code:

DataItemTableView = Sorting(Number) Where(Number = Const(1)); 

Is this a good practice? Can someone explain this to me pretty please? This code filters all Integers except the one equal to 1? I know that Integer is a virtual table with one field but that's all...

Also, the explanation for the use of Integer was that in the report layout, by including the Number field from the Integer table, you can easily filter out ( in the report's body ) the first empty record sent to the report.

3. In Navision the Dataset structure was always looking like this ( and it made a lot of sense for me ):

DataItem Integer

DataItem Header 

        DateItem Line

In Business Central AL the dataset structure is more like this ( for all reports that I've saw):

DataItem Header

        DataItem Integer

                DataItem Integer

                        DataItem Line

I've tried putting them like that to show them that they are nested. Regarding of what I said at 2., it looked normal for me to create the data set like in Navision.

So my curiosity is : why is the dataset created like that in AL? Especially why are there 2 integers nested into the header and are they both sorted?

Thanks a lot for the time spent reading the post, hope you have a great day!

PS: this is how the Line dataItem looks in the case above ( this is located in the second Integer DataItem as shown in the "structure" above). Please ignore the errors.

pastedimage1626350952663v3.png

I have the same question (0)
  • Suggested answer
    Suresh Kulla Profile Picture
    50,233 Super User 2025 Season 2 on at
    RE: Report looping questions

    1. DateItemTableView is used to sort the date in the underlying table and when it displays or retrieves records it uses that key.

    2. You don't need to use Integer dataitem if you have header and line relationship you can could retrieve those company information while on the header and use.

    Integer dataitem is easy to use and mostly it is used to loop or print the same data multiple times or sometimes if you need to aggregate the data you can keep those in temporary table and use the Integer dataitem to loop the temporary table.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 4,327

#2
Sumit Singh Profile Picture

Sumit Singh 2,734

#3
Nimsara Jayathilaka. Profile Picture

Nimsara Jayathilaka. 2,599

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans