Setting Multiple Key Fields with RECREF and FIELDREF

rsaritzky
Member Posts: 469
Hi all,
Does anyone know if you have a table with a multi-field key and want to set a range/filter on that table in a RecordRef, do you need to define and use multiple FieldRef variables? For example, Table 81 Gen. Journal Line has a primary key = "Journal Template Name,Journal Batch Name,Line No.". If I want to SETRANGE on Journal Template name and Journal Batch name, do I need 2 FieldRef Variables or can I use just 1, e.g. can I do this?:
OR do I need this?
Has anyone tried both versions?
Thanks
Ron
Does anyone know if you have a table with a multi-field key and want to set a range/filter on that table in a RecordRef, do you need to define and use multiple FieldRef variables? For example, Table 81 Gen. Journal Line has a primary key = "Journal Template Name,Journal Batch Name,Line No.". If I want to SETRANGE on Journal Template name and Journal Batch name, do I need 2 FieldRef Variables or can I use just 1, e.g. can I do this?:
FieldRef := GenJnlLineRecordRef.FIELD(1); //Field 1 is Journal Template Name FieldRef.SETRANGE(MyJournalTemplateName); FieldRef := GenJnlLineRecordRef.FIELD(51); //Field 51 is Journal Batch Name FieldRef.SETRANGE(MyJournalBatchName); IF GenJnlLineRecRef.FINDFIRST THEN....
OR do I need this?
FieldRef1 := GenJnlLineRecordRef.FIELD(1); //Field 1 is Journal Template Name FieldRef1.SETRANGE(MyJournalTemplateName); FieldRef2 := GenJnlLineRecordRef.FIELD(51); //Field 51 is Journal Batch Name FieldRef2.SETRANGE(MyJournalBatchName); IF GenJnlLineRecRef.FINDFIRST THEN....
Has anyone tried both versions?
Thanks
Ron
Ron
0
Answers
-
Version 1 works just as fine.0
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