Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Microsoft Dynamics NAV 7 Programming Cookbook

You're reading from   Microsoft Dynamics NAV 7 Programming Cookbook Learn to customize, integrate and administer NAV 7 using practical, hands-on recipes

Arrow left icon
Product type Paperback
Published in Sep 2013
Publisher Packt
ISBN-13 9781849689106
Length 312 pages
Edition 2nd Edition
Languages
Arrow right icon
Toc

Table of Contents (20) Chapters Close

Microsoft Dynamics NAV 7 Programming Cookbook
Credits
About the Author
About the Reviewers
Acknowledgements
www.PacktPub.com
Preface
1. String, Dates, and Other Data Types FREE CHAPTER 2. General Development 3. Working with Tables, Records, and Queries 4. Designing Pages 5. Report Design 6. Diagnosing Code Problems 7. Roles and Security 8. Leveraging Microsoft Office 9. OS Interaction 10. Integration 11. Working with the SQL Server 12. NAV Server Administration Index

Retrieving data using the FIND and GET statements


The FIND and GET statements are two of the most commonly used functions in NAV programming. When it comes to retrieving data, we need to select the right FIND/GET function as it has a significant effect on the performance of the system. This recipe will help you understand how to use the FIND and GET functions.

How to do it...

  1. Create a new codeunit with Object Designer.

  2. Add the following local variables into the run trigger:

    Name

    Type

    Subtype

    Customer

    Record

    Customer

    CustCount

    Integer

     
  3. Add the following code into the OnRun trigger of the codeunit:

    //FINDFIRST
    Customer.RESET;
    IF Customer.FINDFIRST THEN
      MESSAGE('The first customer in the database is:\No.:%1\Name:%2',
              Customer."No.", Customer.Name);
    
    //FINDLAST
    Customer.RESET;
    IF Customer.FINDLAST THEN
      MESSAGE('The last customer in the database is:\No.: %1\Name:%2',
              Customer."No.", Customer.Name);
    
    //FINDSET
    Customer.RESET;
    IF Customer.FINDSET THEN
    REPEAT...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at £16.99/month. Cancel anytime