Actually, the help is wrong (I didn't check the help of NAV2009 though).
In reality GETTABLE is for putting a record-variable into a recordreference and SETTABLE does the opposite.
If you put a record into a recordreference, it also copies the filters.
If you put a recordreference into a record, it doesn't! (I didn't check NAV2009 though).
Regards,Alain Krikilion No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
Yes Kine. I've checked in on-line help as well. And did some tests before asking question here.
According to my tests both SETTABLE and GETTABLE copy filters from record to recordref.
Just wonder if anyone knows real difference between those two functions...
Regards,
Slawek
Ok, didn't know that. But just looking on the function names I assumed what Kriki described, but I know that the SETTABLE is not working as I will assume. Thus I looked into on-line help.
To set filters to record I am using the Rec.SETVIEW(RecordRef.GETVIEW).
NAV2009:
help has been fixed, functionality hasn't been(i tested it with this code, from a kriki tip&trick)
I tested it with both setrange and setfilter (who knows if this could change something? ) without success.
what a shame...
TBSalesInvHead.SETFILTER("Your Reference",'12');
rer[1].GETTABLE(TBSalesInvHead);
rer[2].GETTABLE(TBSalesCrMemoHead);
recField[1].RESET;
recField[1].SETCURRENTKEY(TableNo,"No.");
recField[1].SETRANGE(TableNo,DATABASE::"Sales Invoice Header");
IF recField[1].FINDSET THEN
REPEAT
IF recField[2].GET(DATABASE::"Sales Cr.Memo Header",recField[1]."No.") THEN
IF (recField[1].FieldName = recField[2].FieldName) AND
(recField[1].Type = recField[2].Type) AND
(recField[1].Len = recField[2].Len) AND
(recField[1].Class = recField[2].Class) AND
(recField[1].Enabled = recField[2].Enabled) THEN BEGIN
fir[1] := rer[1].FIELD(recField[1]."No.");
fir[2] := rer[2].FIELD(recField[2]."No.");
fir[2].SETFILTER(fir[1].GETFILTER);
END;
UNTIL recField[1].NEXT = 0;
rer[2].SETTABLE(TBSalesCrMemoHead);
MESSAGE(TBSalesCrMemoHead.GETFILTERS);
MESSAGE(TBSalesInvHead.GETFILTERS);
-Mirko-
"Never memorize what you can easily find in a book".....Or Mibuso My Blog
This is from C/SIDE Reference Guide (Online Help): SETTABLE Function (RECORDREF):
Any filters that are applied to the recordref are also applied to the record. If you change the filter that is applied to the recordref, you must call SETTABLE again to apply the new filter to the record.
In fact, no filter is transferred at all from a recordref to a record.
So it seems that neither online help nor the bug has been fixed (though it would have been sufficient to fix one of them, not both ). This is true for NAV 2009 SP1, too.
Comments
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
According to my tests both SETTABLE and GETTABLE copy filters from record to recordref.
Just wonder if anyone knows real difference between those two functions...
Regards,
Slawek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
In reality GETTABLE is for putting a record-variable into a recordreference and SETTABLE does the opposite.
If you put a record into a recordreference, it also copies the filters.
If you put a recordreference into a record, it doesn't! (I didn't check NAV2009 though).
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
Ok, didn't know that. But just looking on the function names I assumed what Kriki described, but I know that the SETTABLE is not working as I will assume. Thus I looked into on-line help.
To set filters to record I am using the Rec.SETVIEW(RecordRef.GETVIEW).
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
help has been fixed, functionality hasn't been(i tested it with this code, from a kriki tip&trick)
I tested it with both setrange and setfilter (who knows if this could change something? ) without success.
what a shame...
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
SETTABLE Function (RECORDREF):
Any filters that are applied to the recordref are also applied to the record. If you change the filter that is applied to the recordref, you must call SETTABLE again to apply the new filter to the record.
In fact, no filter is transferred at all from a recordref to a record.
So it seems that neither online help nor the bug has been fixed (though it would have been sufficient to fix one of them, not both ). This is true for NAV 2009 SP1, too.
JobRec.SETVIEW(MyRecordRef.GETVIEW);
Then you also have the filters.