Get the third record

sharon95
Member Posts: 183
I have a table with three fields (number, city, postcode), I have to get the city based on the number choosed. How can I do it?
0
Best Answers
-
If the "number" field is an integer AND the records are sequential starting from 1 AND it is the Primary Key then you can just do the following...
MyTable.GET(n);
...however in not all the above apply then you can do the following (although it will be slower)...MyTable.FIND('-'); IF n > 1 THEN MyTable.NEXT(n - 1);
5 -
Once you've got the 4th record using one of the techniques above, you can do a...
MESSAGE('The 4th City is %1',MyTable.City);
...or if you need a question then...IF CONFIRM('Select 4th City: %1?',FALSE,MyTable.City) THEN...
5 -
Because Num is probably an Integer
. Try this instead...
Merged := FORMAT(tb1.Num) + ' ' + tb2.city; MESSAGE('%1 %2', Merged);
...OR...MESSAGE('%1 %2', tb1.Num, tb2.city);
P.S. If my previous posts helps then you should select the "Yes" option on the "Does this post answer your question YES / NO"5
Answers
-
*Get the n-th record0
-
If the "number" field is an integer AND the records are sequential starting from 1 AND it is the Primary Key then you can just do the following...
MyTable.GET(n);
...however in not all the above apply then you can do the following (although it will be slower)...MyTable.FIND('-'); IF n > 1 THEN MyTable.NEXT(n - 1);
5 -
But, let's say I want to prompt with a message the 4th city, how can I do this?
0 -
Once you've got the 4th record using one of the techniques above, you can do a...
MESSAGE('The 4th City is %1',MyTable.City);
...or if you need a question then...IF CONFIRM('Select 4th City: %1?',FALSE,MyTable.City) THEN...
5 -
thank youuuuuuuuuuuuuu0
-
this doesn't work .... whyy?
tb1.GET(1);
tb2.GET(2);
Merged := tb1.Num + ' ' + tb2.city;
MESSAGE('%1', Merged);
0 -
Because Num is probably an Integer
. Try this instead...
Merged := FORMAT(tb1.Num) + ' ' + tb2.city; MESSAGE('%1 %2', Merged);
...OR...MESSAGE('%1 %2', tb1.Num, tb2.city);
P.S. If my previous posts helps then you should select the "Yes" option on the "Does this post answer your question YES / NO"5 -
It says that the table doesn't exist..... why?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