I saw the Navision help, but still got confusing about this data type. :?
Could anyone give me some simple example for the best practice of recordref, or in any kind of situation we have to or better to use this data type.
Any advice would be appreciated.
Thank you.
0
Comments
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
I've once made some extra discount-fields on the sales line, sales invoice line, return receipt line and sales credit memo line.
I've kept the fieldnumbers in each table the same so TRANSFERFIELDS works for the new fields.
Next a form "Discount Display Form" shows the new fields for all the tables by using RecordRef and FieldRef.
See code below how it was applied:
Advantage in this case:
- only 1 form needed. In case of modifications, you only have to modify a single form.
Disadvantage:
- it's more difficult to create than a 'normal' form.
Tino Ruijs
Microsoft Dynamics NAV specialist
See below an example which I recently wrote for an interface to an external application:
IF NOT IsLogActive() THEN
EXIT;
CurrNo := InsertExportHeader(RecRef, oOperate::Update);
FOR i := 1 TO RecRef.FIELDCOUNT DO BEGIN
FldRef := RecRef.FIELDINDEX(i);
IF IsNormalField(RecRef.NUMBER, FldRef.NUMBER) THEN
InsertExportLine(FldRef, CurrNo);
END;
I think this shows how RecRef and FieldRef can work together.
As kine said before, RecRef virtually can represent any record. So you are enabled to write really flexible code. Its just a higher level of abstraction.
(InsertExportHeader, IsNormalField, InsertExportLine are (sub-)function and not declared here)
Josef Snayberk
I got to take some times to digest your helping.
It's a different concept I have never heard.
Are there have same data type in other programing language... :?
As you said that change log example....probably I can refer to Codeunit "Change Log Management".InsertLogEntry function?
Kind Regards,
gison
What does these exist for? When we get a table by RecordRef then do the modification for this table...What are the KeyRef, FieldRef, FieldIndex.... :?
Sorry...for the troubling problem and thank you all your helping.
For KeyRef, FieldRef, FieldIndex you could search this site (i.e. http://www.mibuso.com/forum/viewtopic.php?t=7767&highlight=keyref) or press F1 when you're in the C/AL Symbol Menu on a recordref variable.
Tino Ruijs
Microsoft Dynamics NAV specialist
I appreciate your help.
I'm figuring out.........