List Form

bekio
Member Posts: 204
Hello everyone!
At from Employee List i want to display a field Number that i want to be increment from 1, for 1.
If i filter this form i want again that this field Number to be from 1 incremented by 1.
Need Help!
At from Employee List i want to display a field Number that i want to be increment from 1, for 1.
If i filter this form i want again that this field Number to be from 1 incremented by 1.
Need Help!
0
Answers
-
I'm sure you can do it, but it's really going to slow down the form. What is the business need? Maybe there is a better solution.0
-
Hi Bekio,
It is possible and suprisingly easy to do, but it does involve quite a bit of processing.
So I wouldn't do this if your employee table holds a lot of records.
Declare 2 Global variables:
1. TempInt, Integer : This will be your line number
2. T5200, Record Table 5200.
In the OnAfterGetRecord put the following Code:T5200.COPYFILTERS(Rec); IF T5200.FINDFIRST THEN IF T5200."No." = "No." THEN TempInt := 1 ELSE TempInt := TempInt + 1;
And then add the "TempInt" field to the table box as the first field.
Make sure you set the "Editable" and "Focusable" properties to "No".
Also set your caption to what it needs to be.
Hope this helps,
Regards,
WillyFostering a homeless, abused child is the hardest yet most rewarding thing I have ever done.0 -
This of course does not work because there's no guarantee it starts counting from the first record and moreover it increments its counter even on revisiting records shown already or jumping to new ones.
What would work is the following code:T5200.COPYFILTERS(Rec); T5200.FILTERGROUP(10); T5200.SETFILTER(T5200."No.",'..%1',Rec."No."); T5200.FILTERGROUP(0); TempInt := T5200.COUNT;
... but that's a little expensive.
I doubt, however, that this is what is really needed (I cant think of any useful application), but as matttrax saidmatttrax wrote:... What is the business need? Maybe there is a better solution.0 -
You need to use a second record on which you apply the same filters and the same sorting with the form. Then loop that recordset from the first record until you find a record with the same primary key as the one you are on on the form.
This is something like MS Access (record x of y).
BUT:
a) Depending on the filters, sorting and number of records, it could be really slow.
b) Once you do it, then the customer will start asking for the same thing on all forms.
So think about it again and decide.
I've done it for a customer but I really stressed out the negative side of the solution.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