Records shown in Form

keiah
Member Posts: 9
My problem is the need to show only specific records from a table in a form (similar to reports, currreport.showoutput). 
I generated a form based on table 5409 (prod order routing line). Now I only will show records in the form, which are based on a production order with status "released".
I tried in the OnAfterGetRecord() trigger in the new form:
ProductionOrder.RESET;
ProductionOrder.SETCURRENTKEY(Status, "No.");
ProductionOrder.SETRANGE(Status, Status::Released);
ProductionOrder.SETRANGE("No.","Prod. Order No.");
IF NOT ProductionOrder.FIND THEN EXIT;
but always all records of the table 5409 are shown.
Any hints how to supress records in forms without an additional table? :-k

I generated a form based on table 5409 (prod order routing line). Now I only will show records in the form, which are based on a production order with status "released".
I tried in the OnAfterGetRecord() trigger in the new form:
ProductionOrder.RESET;
ProductionOrder.SETCURRENTKEY(Status, "No.");
ProductionOrder.SETRANGE(Status, Status::Released);
ProductionOrder.SETRANGE("No.","Prod. Order No.");
IF NOT ProductionOrder.FIND THEN EXIT;
but always all records of the table 5409 are shown.
Any hints how to supress records in forms without an additional table? :-k
Kai Huegle
from mack-rides.com
from mack-rides.com
0
Comments
-
HI,
The easiest way around this is to add a flowfield to Table 5409 that is a simple lookup to the Status field in the Production Order table (linked by No.).
Then you can just do a simple setrange on open form.
e.g.
SETRANGE(StatusLookup,StatusLookup::Released);
You will just need to add the new StatusLookup field to the CalcFields on the Form properties.
This should work.
The only other option I can think of would be to mark the records using your existing OnAfterGetRecord code.
It would need to look something like this:
ProductionOrder.RESET;
ProductionOrder.SETCURRENTKEY(Status, "No.");
ProductionOrder.SETRANGE(Status, Status::Released);
ProductionOrder.SETRANGE("No.","Prod. Order No.");
IF ProductionOrder.FIND THEN
MARK(TRUE);
MARKEDONLY(TRUE);
The only problem with this solution is that the MARKEDONLY(TRUE) line is within the OnAfterGetRecord trigger so it will be executed for each record. I can't think of another trigger to use off the top of my head, but you might be able to play around with it so that it is only called once (after all the records have been marked).
Hope this helps!0 -
Hi,
thx for your help, I tried first solution and it works fine. \:D/
I just tried your second solution as well, but seems as it doesn't work as I implemented. I will try it again next days.
Thx a lot for your help!
KaiKai Huegle
from mack-rides.com0
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