Sort Report by third table value

Ello
Member Posts: 5
I have a report which displays lines sorted by linenumber, but I want to sort the results a kind different.
I have the following setup:
Dynamics NAV 2009 SP1 / Dynamics NAV 6.0 SP1 Classic Client
Table: Sales Line
Relevant Fields: Document Type, Document No, Line No., Type, No., ShelfNo(foreign key to item.ShelfNo)
Table: Item
Relevant Fields: No, ShelfNo(foreign key to table shelves)
Table: Shelves
Relevant Fields: ShelfNo (Code10), WalkSortNumber (int)
Now I want to the have the result of the Report ordered by the value of Shelves.WalkSortNumber
Here is my whished result explained in SQL-ish
I have the following setup:
Dynamics NAV 2009 SP1 / Dynamics NAV 6.0 SP1 Classic Client
Table: Sales Line
Relevant Fields: Document Type, Document No, Line No., Type, No., ShelfNo(foreign key to item.ShelfNo)
Table: Item
Relevant Fields: No, ShelfNo(foreign key to table shelves)
Table: Shelves
Relevant Fields: ShelfNo (Code10), WalkSortNumber (int)
Now I want to the have the result of the Report ordered by the value of Shelves.WalkSortNumber
Here is my whished result explained in SQL-ish
select [...] from [Sales Line] sl inner join [Item] it on item.No = sl.No inner join [Shelves] shf on it.ShelfNo = shf.ShelfNo where [...] order by shf.WalkSortNumber ASC
0
Comments
-
2 possibilities:
1.
Add the field walksortnumber to the sales line populating it when the item is validated. Add a new index.
2.
Use a temporary table in your report.
First read all the necessary data and write everything into a temporary table. Then print based on your temp table.Frank Dickschat
FD Consulting0 -
Do you need the Items here? Isn't ShelfNo foreign key to Shelves, connecting Sales Lines directly to Shelve?
Then you might loop over your Sales Lines, get the associated Shelves and either mark them or copy them to a temporary Shelve table. Then create a dataitem for the marked or temporary Shelve table and a nested Sales Line dataitem with the output section.0 -
thank you, I will give it a try0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions