Request page coding problem of a report.

Rajat_M
Member Posts: 34
Hello Experts,
Right now I'm working on a report. I have taken two DataItems: Item Ledger Entry & Item Journal Line. Now I need to set four request page filters i.e. Item No., Location Code, Entry Type, Posting Date(Start Date, End Date).
For that I have taken five variables in C/AL Global i.e. Item No.(Code), Location Code(Code), Entry Type(option), Start Date(Date), End Date(Date).
I have also declared those fields on Request Page Designer.
Now I have written the following code:
Item Ledger Entry
OnPreDataItem():
SETRANGE(Item Ledger Entry.Posting Date, Start Date, End Date);
SETRANGE(Item Ledger Entry."Item No.", "Item No.");
SETRANGE(Item Ledger Entry.Location Code, Location Code);
SETRANGE(Item Ledger Entry.Entry Type, Item Ledger Entry.Entry Type :: "Negative Adjustment");
The code has run but whenever I enter any values on the request page the report doesn't shows any data. If I left those fields empty the report shows all the data. I have no clues how to correct it. Please Help me!
Right now I'm working on a report. I have taken two DataItems: Item Ledger Entry & Item Journal Line. Now I need to set four request page filters i.e. Item No., Location Code, Entry Type, Posting Date(Start Date, End Date).
For that I have taken five variables in C/AL Global i.e. Item No.(Code), Location Code(Code), Entry Type(option), Start Date(Date), End Date(Date).
I have also declared those fields on Request Page Designer.
Now I have written the following code:
Item Ledger Entry
OnPreDataItem():
SETRANGE(Item Ledger Entry.Posting Date, Start Date, End Date);
SETRANGE(Item Ledger Entry."Item No.", "Item No.");
SETRANGE(Item Ledger Entry.Location Code, Location Code);
SETRANGE(Item Ledger Entry.Entry Type, Item Ledger Entry.Entry Type :: "Negative Adjustment");
The code has run but whenever I enter any values on the request page the report doesn't shows any data. If I left those fields empty the report shows all the data. I have no clues how to correct it. Please Help me!
0
Answers
-
Why you are not using some of these Filters that comes in built with the Data items - That comes up when you run the Report instead of taking variables and doing so?.Thanks
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/0 -
Hi,
Give the variables names that are different from the field names.
good luck.\\The truth exists in seven versions.1 -
Take care! If you leave e.g. the "Item No." variable empty on the request page, your code will filter for Item Ledger Entries with an Item No. empty. Either you must check a code is given for each filter or you must guard each SETRANGE statement with
IF <Requested Code> <> '' THEN SETRANGE ...
for any field for which no code means no filter.
Apparently you have done something like this already, because otherwise you would not get all entries when entering no filter codes on the request page.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