Hi all! You all know this one: Form.RUNMODAL(0, Record) How to perform something like this: Form.RUNMODAL(0, RecordRef) Any ideas? Thanx in advance! Regards,
This question has a very simple answer: Not possible in any of the current versions of Navision!
[V] Toooo baaad … any work-arounds?
Joerg, Can you explain what is the exact reason of using Recordref here and not the acual Table variable or Temp. variable.
I have a small application for setting up “Mandatory Fields” per table. Here one could set up Table No. and Field No. that will be checked within a codeunit using RecRef and FieldRef - so far no problem. I can also open a form which is showing the Record ID of complete/incomplete records of a table by using this setup, then, when selecting one record I am also able to show which fields of that record are complete/incomplete. Now I need a possibility, to run a form that is based on that real record, to give the user a chance to complete the record … and here I’m stuck [xx(]
I know this question is 4 years old. But so is the answer. Back then it wasn’t possible. So I would like to know if anyone know if it has become possible now or if they can recommend a good work around?
Instead of calling Form.RUNMODAL directly you can call the form via a variable referring to - well - the form.
In the form, define a function with a RecordRef-parameter. The function will receive the RecordRef-parameter and assign it to a global RecordRef-variable in the form.
Now - call VariableForm.RUNMODAL and use the RecordRef…
You don’t know which form. The rec solves this but recref not.
I’m using this one http://www.mibuso.com/forum/viewtopic.php?p=41023
Yeah, also an ok work around. But it doesn’t quite solve the issue that you still have to write special programming to all forms before you can use it. And then we really have the same problem.
As I see it, then the really great thing about RecordRef is that you can make code which does not require you to “hard code” any specific tables or forms.
Not sure about the older versions, but in NAV 2009 R2 this can be done with the use of Variant datatype:
rRef: RecordRef;
var: Variant;
rRef.OPEN(18); //Customer
var := rRef;
FORM.RUNMODAL(0,var);
The only problem is that you can not apply filters to the record, because they get lost when you assign RecRef to the Variant variable. First record in the filter DOES get selected though. Example below:
rRef.OPEN(18); //Customer
rRef.FILTERGROUP(5);
fRef := rRef.FIELD(2); //Customer.Name
fRef.SETFILTER(‘T*’);
rRef.FILTERGROUP(0);
rRef.FINDSET;
var := rRef;
FORM.RUNMODAL(0,var); //Form shows all records but is focused on the first that fits in the filter ‘T*’.
I hope that helps someone else too.