How to make a default key in a report?
pdj
Member Posts: 643
I have a simple report where I would suggest the user to use a certain key, a default key. (not the primary key)
But it should be possible for the user to pick any key he/she wishes. (including the primary key)
If I set a key in DataItemTableView it can't be changed by the user.
If I don't set a key in DataItemTableView I can't select a different default key. (Tried both OnInitReport and OnOpenRequestForm)
I can only see two solutions, which both are quite bad:
1) Execute the report from a codeunit. (Un-tested, but I think it will work)
2) Create a lookup (either a static dropdown or dynamic to the new Key table) and use the selected key in OnPreDataitem.
What am I missing?
But it should be possible for the user to pick any key he/she wishes. (including the primary key)
If I set a key in DataItemTableView it can't be changed by the user.
If I don't set a key in DataItemTableView I can't select a different default key. (Tried both OnInitReport and OnOpenRequestForm)
I can only see two solutions, which both are quite bad:
1) Execute the report from a codeunit. (Un-tested, but I think it will work)
2) Create a lookup (either a static dropdown or dynamic to the new Key table) and use the selected key in OnPreDataitem.
What am I missing?
Regards
Peter
Peter
0
Comments
-
This has annoyed me for as long as I have been using Navision. It would be nice if you could set a default and then let the user select a different key. There are a number of solutions to this, and all involve code.
If you need to offer only a few keys (say the report is based on Item ledger entry table, and the first element of the key MUST be Item No. then you can just create a drill down on the options tab to determine which key to use.
If the user will never select the primary key (say where primary key is Entry No), then you can add code to check the current key and if it is entry no, then you know the user did not select a key, so you can then set the default key.
But you need to know more about the actual customer request before you can determine which is the best option.
In most cases, I let the user select the key, and just train them properly. I am always in favor or raining over coding.David Singleton0 -
The user already had two keys selectable in the requestform as you describe in your first solution. I was just surprised that I couldn't see a simple solution to make all keys selectable while keeping a default key. I actually started making a solution using the Key table, but it shows field names and not field captions. Then I would have had to make a solution with KeyRef and FieldRef instead. And that was "slightly" overkill for the change request...
I simply ended up solving it by simply adding the third key they requested in the existing dropdown field. The new key they wished to use was the primary key, so I couldn't use your other suggestion.
But thanks a lot for your reply - I feared I was the only one unable to see the simple solution :?Regards
Peter0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K 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
- 324 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
