GET function

sharon95
Member Posts: 183
If a table has the primary key made up of three values, can I use get for only one value?
e.g.: PK: (number,name,city).
How can I use the GET function if I have only the number? Thank you
e.g.: PK: (number,name,city).
How can I use the GET function if I have only the number? Thank you
0
Answers
-
No. You can SETRANGE(number,'Value') and FINDFIRST.0
-
Actually you can do GET('VALUE 1') but that means NAV considers the other fields of the primary key the blank value ('' for text/code, 0 for int/dec, 0D for date,...)Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Be carefull. GET accepts one argument, even if the primary key consists of three fields, but GET uses the init value for those fields, not prowided (not sure if it uses the field's init value, or the type's, but you shouldn't use this anyway, just be aware that you won't get an error if you use too few parameters.
In your case, you need to use SETRANGE, and carefully think about what you should do if there are more than one records matching. IF you don't care, or are sure for business logic reasons, that only one can exist, use FINDFIRST, as da_neal suggested. otherwise use FINDSET and NEXT.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