Is there a reliable way of finding the current line no. in a form? Rec.“Line No.” is not reliable because, if I am on line 3000 and press F8, then Rec.“Line No.” becomes 2000 (until the next key is pressed). Thanks, Alastair P.S. Detecting that the user has pressed F8 seems to be difficult, judging by another thread I started last Friday.
What is your final objective with today’s and Friday’s question? It looks as if you are trying to wrongly approach your problem. What are you trying to do and where? It will be easier for us to help you.
When you press F8 on line 3000, you copy the value of the same field from the record above it. So Rec.“Line No.” being 2000 is correct. Because the value is correct, accessing Rec.“Line No.” is reliable. q.e.d.
Sure! Please tell us what you would like to do. Otherwise you should basically be able to get the precise record in a table (Finf(’-’), Get, or find(+), and onc ethat is done, any field is accurately accessible!. Regrads. RBM P.S: Also make sure you have the right record is you are using things like repeat … .next.
Hi Nelson, thanks for your reply. I am trying to get F8 to work correctly. When I press F8 on Purchase Order line 3000, the field is copied from line 2000, as expected. But the shortcut dimensions are sometimes changed too [Shortcut dimensions 3 - 8 are stored in an array on the Purchase Order form, not in the Purchase Line table]. This is sporadic and difficult to reproduce. Usually the incorrect changes are corrected after the user goes to another record and back again to line 3000, so the array is refreshed; but occasionally, on our system, the incorrect changes have been written to the database. Since the dimension fields are hidden, the user may not even realise this. It’s strange that on F8, the entire subform Rec gets temporarily assigned to record 2000, but, as expected, only the current field gets copied from line 2000. I don’t know how or why Navision does that. If we can detect that the user has pressed F8 (or reliably know the current line no), then we might be able to solve this problem, which is why I posted today and Friday. Regards, Alastair
I’ve just seen Daniel’s post. Let us say that the user presses either F8 (and stays on line 3000) or the Up arrow (to go to line 2000). I cannot tell the difference, so I cannot tell whether to display dimensions for line 2000 or line 3000. This is my problem.
When you press F8 on line 3000 (making Navision copy the value from line 2000) Navision won’t let you do arrow up, because the record already exists. The line number is part of the primary key, so it wont allow two records with the same line number. Of course I am assuming that youa re talking about sales orders/invoices/credit memos, you know the standard Navision stuff with line numbers.
I think there has been a misunderstanding. I do not mean that the user is in the “Line No.” field - the Designer licence would be needed to make this visible anyway, and making it visible would lead to problems. What I mean is that the user is on some normal field like Description. Suppose the following three records are on display: (line no.) Type No. Description (1000) G/L Account 62210 Brokerage (2000) G/L Account 22894 WIP - Sales (3000) Item 100 Adaptor [USER IS HERE] The user presses F8. OnAfterGetRecord gets triggered, and in the debugger Rec now strangely has the following values: (2000) G/L Account 22894 WIP - Sales yet on screen the cursor is seen to be on the following record (and after pressing Up and Down, this is what is seen in the debugger too): (3000) Item 100 WIP - Sales [USER IS HERE] I guess that now everything is as clear as mud.