The Problem:
1. I have created a form with a table box.
2. The user scans the barcode and I insert the record into the table box.
3. Everything is perfect BUT once you scan more lines than you can physically see in the table box NAV does not automatically scroll to the last record so you can see what you've just scanned.
I have looked through the online postings, tips and tricks and I cannot find any way where I can force NAV to scroll to the last record scanned. I even sorted it in descending order hoping that NAV would show the first record as the last scanned entry but the table box does not refresh. Everytime I have to manually scroll to see the last record scanned.
I have changed properties on the form which only work if the form is re-opened but I need NAV to refresh the table box and show the last record scanned after each insertion of a line. Calling a CurrForm.UPDATE(FALSE) does not refresh the table box either.
Can anyone help me? ](*,)
David
0
Comments
I do not think though you can activate a tablebox - you might want to try and put the tablebox in a subform, and call a function in the subform to update it, and then activate it. The problem you would run into though is that then the cursor will be on the subform - not where you want the user to be scanning.
Technical Consultant, MS Dynamics NAV
1) one form with a table Box and
2) The source table for the form
Just check if it helps you....... O:)
Technical Consultant, MS Dynamics NAV
I imported your objects and yes it will work because you are calling a FINDLAST after inserting the record and you are working on one instance.
This is my design:
1. I have a Scan Header (main form) which shows a running total of the different items scanned.
2. I have a Scan Lines (sub form) which shows the scanned lines. This is the form that doesn't scroll to the last record.
3. The user scans the barcode into a textbox on the main form, a codeunit is called which processes the barcode and inserts the data into the Scan Line table. Therefore I am using a second instance to achieve this.
4. Execution of the program returns to the textbox for the next scan. The subform does not scroll to the entry just scanned.
I need to be able to force the SubForm to show the last record...any ideas?
David
I suggest also to just have a form which would show the lines.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Another suggestion is to put the textbox for scanning in the subform
Dynamics Nav Add-ons
http://www.simplydynamics.ie/Addons.html
I cannot place the lines on a new form because the customer wants to see the Header entries because this shows him specific item details which must be visible at all times.
Hi Dave,
I have placed the scan textbox on the subform but I have a runtime error when I press the Enter key while focus is on this textbox. Even with no text entered and all code removed from the form, NAV 5 gives the following error: "A(n) label cannot be activated." I don't even have any label on the subform.
The subform will open but once you click on the textbox and hit enter the error always occurs.
Have you experienced this?
If you place a textbox on a Main form and set the NextControl to itself, then after any messages are displayed, the cursor will return to the textbox. If you place this textbox on a Sub form you will get the above-mentioned error.
However, the SubForm tablebox still does not jump to the last record just scanned....so the original problem persists.
just try this and see if it helps..... O:)
1) for scan line form --> Properties : SourceTablePlacement : Last
2) In scan header form after calling to your codeunit
you may have to call your CodeUnit as
if (CODEUNIT.RUN(Number [, Record]) then
begin
CurrForm.UPDATE(FALSE);
COMMIT;
FORM.RUNMODAL("Id of your scanHeader Form",Rec);
CurrForm.CLOSE;
end;
Technical Consultant, MS Dynamics NAV
here is another (and cleaner) solution ... :P
1) for your scan line form --> Form - OnAfterGetCurrRecord()
Technical Consultant, MS Dynamics NAV
Both your ideas work but unfortunately they give new problems:
Option 1: Open New Form ](*,)
Each form closed is not really being closed. It is not freed from memory.
The users will use my scanning functionality for Sales, Transfers and Stock Takes. On average they will scan about 20 lines or more. This means that there will be about 20 Forms or more listed under the Window menu item on the Tool Bar. As a result of this, when you close the form you are on, NAV freezes while it closes all the other forms as well.
Option 2: FindLast on OnAfterGetCurrRecord ](*,)
I call a FindFirst because I sort the entries in descending order. This will refresh the table box but you can't scroll properly because each time you scroll you trigger the OnAfterGetCurrRecord and it re-positions the cursor on the first record, therefore you never get to the end of the tablebox.
Thanks for your help so far. I do appreacite it...
David ](*,)
here is a bit updation in the "Option 2" approach ....... O:)
1) In scan line form --> declare a global boolean : gotoLast
2) In scan line form --> declare a Function : SetGoToLast
3) In Function SetGoToLast() 4) In scan line form --> Form - OnAfterGetCurrRecord() 5) In scan header form after calling to your codeunit
I hope it helps......... O:)
Technical Consultant, MS Dynamics NAV
Just shows you how helpful it can be to have a fresh pair of eyes. \:D/
Thanks very much for all your help....much appreciated !!! =D>
Technical Consultant, MS Dynamics NAV