RecordRef to RecordRef

mgm
Member Posts: 126
With a Sales Header record, I want to get the E-mail adress of a Customer.
I made a general function to do this and it works fine.
But is there an easier way to get the second RecordRef io. the above?
Something like RecordRef2.GET(RecordRef......) ?
I made a general function to do this and it works fine.
GetEmailTableID(RecRef : RecordRef) : Text[80] CASE RecRef.NUMBER OF 36,110,112,114: BEGIN RecRef2.OPEN(18); FieldRef2 := RecRef2.FIELD(1); FieldRef2.VALUE := FORMAT(RecRef.FIELD(2)); //="Sales Header"."Sell-to Customer No." IF RecRef2.FIND('=') THEN BEGIN FieldRef := RecRef2.FIELD(102); EXIT(FieldRef.VALUE); END; END;
But is there an easier way to get the second RecordRef io. the above?
Something like RecordRef2.GET(RecordRef......) ?
0
Comments
-
Yes, the above example can be shorter because the second recordref is not needed.
Just add the customer table as a local variable.IF RecRef.NUMBER IN [36, 110, 112, 114] THEN BEGIN Cust.GET(RecRef.FIELD(2).VALUE); EXIT(Cust."E-Mail"); END;
Reijer Molenaar
Object Manager0 -
Thanx Reijer,
It's an option. But I don't want to declare a record variable, like Customer.
I want to link other tables as well in the same function, so make the function with as least variables as possible.
That's why I want to use a second RecordRef variable.
Maarten0
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