get function

sharon95
Member Posts: 183
If a table has only one primary key, and I want to use the get function to search a record corresponding at one value, how can I do it? thanks!
0
Best Answer
-
Yes, a primary key can be made up of more than one field5
Answers
-
You must use RecordVariable.GET(Field1Value) to that the desired record. The number of values which go inside the GET function are the number of fields in the Primary key of the RecordVariable's table.
Note that a table can have only one primary key.
Please check this https://msdn.microsoft.com/en-us/library/dd301056(v=nav.90).aspx to get more knowledge on GET function.1 -
@ishwarsharma016 "a table can have only one primary key"!?!?1
-
Yes. Please go through this link;
https://msdn.microsoft.com/en-us/library/dd338755.aspxSoftware Developer,
Archerpoint India Pvt. Ltd,Chennai.0 -
Table.GET('Respective value which you want to look for');
Like - Item.GET(SalesLine."No.");Thanks
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/0 -
binilabraham wrote: »Yes. Please go through this link;
https://msdn.microsoft.com/en-us/library/dd338755.aspx
but a primary key can be made up of more than one field, right?0 -
Yes, a primary key can be made up of more than one field5
-
If you have more fields in the primary key, but you want to search on just one of these values, than you cannot use GET
In that case use SETFILTER or SETRANGE, and then FINDFIRST/FINDSET/FINDLAST.
Example for table 36 'Sales Header' that has 2 fields as primary key: "Document Type" and "No.". Now if you know the document number, like 'SO-W001' you could write:SalesHeader.SETRANGE("No.", 'SO-W001'); IF SalesHeader.FINDFIRST THEN MESSAGE ('%1 has document type %2',SalesHeader."No.",SalesHeader."Document Type");
Jan Veenendaal0
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