[NAV5] Run a form with a predefined filter
ben5000
Member Posts: 110
Hi I'd like to run a list form from a report with predefined filters. Here is the code I use.
The problem is that this code shows me the list form but with the information of the last record and not the current one.
I'm new to NAV developing so be indulgent
Thx.
The problem is that this code shows me the list form but with the information of the last record and not the current one.
Component3.SETFILTER(Active,'=%1',Component3.Active::"1");
Component3.SETFILTER("Parent Service Item No.",ParServItemNo); <- this should normally limit the filter on the current record.
//Runs the component list
IF Component3.FINDSET THEN
CompForm.SETRECORD(Component3);
CompForm.RUNMODAL;
CLEARALL;
I'm new to NAV developing so be indulgent
Thx.
0
Comments
-
And where is the current record set?
Better use this code// it is best to always put RESET/SETCURRENTKEY to make it clear there are no filters on it (in case there shouldn't) Component3.RESET; Component3.SETCURRENTKEY(....); Component3.SETRANGE(Active,Component3.Active::"1"); // try always to use SETRANGE instead of SETFILTER Component3.SETRANGE("Parent Service Item No.",ParServItemNo); <- this should normally limit the filter on the current record. //Runs the component list IF Component3.FINDFIRST THEN ; FORM.RUNMODAL(0,Component3); // or replace 0 with FORM::"the form you need" // CLEARALL cleans current object completely. Probably it is not what you want
If it doesn't do yet what you want, check if findfirst takes the correct record by doing a MESSAGE('%1',Component3) after the FINDFIRST.
Check also if the form doesn't reposition the record through code or properties.
PS: this is helpful to start: http://www.mibuso.com/howtoinfo.asp?FileID=22Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 610 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 253 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions