Empty value in FieldRef

robthemobb
Member Posts: 14
Hey folks,
this piece of code seems quite trivial, but I am stuck with it.
I would have expected to get the Document Type in the first Message and the Sell-to Customer No. in the two latter ones, but NAV shows only the Doc Types value. Am I missing something? Obviously, but what? I first ran into this in Business Central, then tried to narrow it down in NAV2018.
Why is there no value for the Customer No?
this piece of code seems quite trivial, but I am stuck with it.
I would have expected to get the Document Type in the first Message and the Sell-to Customer No. in the two latter ones, but NAV shows only the Doc Types value. Am I missing something? Obviously, but what? I first ran into this in Business Central, then tried to narrow it down in NAV2018.
Why is there no value for the Customer No?
SalesHeader.FINDFIRST; RecId := SalesHeader.RECORDID; RecRef := RecId.GETRECORD; FieldRef := RecRef.Field(1); Message(Format(FieldRef)); FieldRef2 := RecRef.Field(2); Message(Format(FieldRef2)); // CU 701 DataTypeManagement DataTypeManagement.FindFieldByName(RecRef, FieldRef2, 'Sell-to Customer No.'); Message(Format(FieldRef2));
0
Best Answer
-
Hi.
Instead of using 'RecRef := RecId.GETRECORD' use 'RecRef.GET(RecID)'.
From the help page for GETRECORD it says:
Remarks
No data is read from the database when you run this function and therefore, no other fields in the record are set. Furthermore, no filters are set on the record.
5
Answers
-
Hi.
Instead of using 'RecRef := RecId.GETRECORD' use 'RecRef.GET(RecID)'.
From the help page for GETRECORD it says:
Remarks
No data is read from the database when you run this function and therefore, no other fields in the record are set. Furthermore, no filters are set on the record.
5
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions