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.
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.
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.