Translate NAV Filter expression into Transact-SQL

rsaritzky
Member Posts: 469
Hi all,
I have a client who has a series of reports built in Native SSRS. They would like to enhance their reporting which requires a series of filter expressions. Here's a very brief example. I'm filtering on the Item Value Entry table:
Line 1 represents a group of transactions with the following filters:
Gen Prod Posting Group = RK or RET-RK and
Gen Bus Posting Group = DOMESTIC and
Customer Posting Group = DEALER-MUS or DEALER-MR
Line 2 represents a different group:
Gen. Prod Posting Group = RKNROLR or Returns-RR and
Gen Bus Posting Group = DOMESTIC and
Customer<>C000628
I realize that it may not look logical, but I'd like to focus on the "how" and not too much the "why"...
I had an idea of allowing the user to store a series of filter expressions in a NAV table, which would be passed/used by the SSRS reports to filter the query. I’d define a table that allows me to specify:
• Group Code
• Gen Prod Posting Group Filter
• Gen Bus Posting Group Filter
• Customer Posting Group Filter
• Customer Filter
They would enter normal NAV filter expressions, e.g. Line 1 above would be:
Gen Prod Posting Group Filter = RK|RET-RK
Gen Bus Posting Group = DOMESTIC
Customer Posting Group = DEALER-MUS|DEALER-MR
Then, my SQL Query or stored proc that builds the SSRS report would read the record stored in NAV above and "translate" it to a properly-formatted where clause, e.g.
WHERE
[Gen Prod Posting Group] IN ('RK','RET-RK') AND
[Gen. Bus Posting Group] = 'DOMESTIC' AND
[Customer Posting Group] IN ('DEALER-MUS','DEALER-MR')
Has anyone built - or seen - any Transact-SQL or C/AL code to parse out NAV filter expressions into Transact-SQL?
Thanks
I have a client who has a series of reports built in Native SSRS. They would like to enhance their reporting which requires a series of filter expressions. Here's a very brief example. I'm filtering on the Item Value Entry table:
Line 1 represents a group of transactions with the following filters:
Gen Prod Posting Group = RK or RET-RK and
Gen Bus Posting Group = DOMESTIC and
Customer Posting Group = DEALER-MUS or DEALER-MR
Line 2 represents a different group:
Gen. Prod Posting Group = RKNROLR or Returns-RR and
Gen Bus Posting Group = DOMESTIC and
Customer<>C000628
I realize that it may not look logical, but I'd like to focus on the "how" and not too much the "why"...
I had an idea of allowing the user to store a series of filter expressions in a NAV table, which would be passed/used by the SSRS reports to filter the query. I’d define a table that allows me to specify:
• Group Code
• Gen Prod Posting Group Filter
• Gen Bus Posting Group Filter
• Customer Posting Group Filter
• Customer Filter
They would enter normal NAV filter expressions, e.g. Line 1 above would be:
Gen Prod Posting Group Filter = RK|RET-RK
Gen Bus Posting Group = DOMESTIC
Customer Posting Group = DEALER-MUS|DEALER-MR
Then, my SQL Query or stored proc that builds the SSRS report would read the record stored in NAV above and "translate" it to a properly-formatted where clause, e.g.
WHERE
[Gen Prod Posting Group] IN ('RK','RET-RK') AND
[Gen. Bus Posting Group] = 'DOMESTIC' AND
[Customer Posting Group] IN ('DEALER-MUS','DEALER-MR')
Has anyone built - or seen - any Transact-SQL or C/AL code to parse out NAV filter expressions into Transact-SQL?
Thanks
Ron
0
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