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.
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,
Willy
Fostering a homeless, abused child is the hardest yet most rewarding thing I have ever done.
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:
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.
Answers
My Blog - nav.education
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:
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,
Willy
What would work is the following code: ... 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 said
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.