Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
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 2009 Programming Cookbook

You're reading from   Microsoft Dynamics NAV 2009 Programming Cookbook Build better business applications with NAV

Arrow left icon
Product type Paperback
Published in Oct 2010
Publisher Packt
ISBN-13 9781849680943
Length 356 pages
Edition 1st Edition
Arrow right icon
Author (1):
Arrow left icon
Matthew Traxinger Matthew Traxinger
Author Profile Icon Matthew Traxinger
Matthew Traxinger
Arrow right icon
View More author details
Toc

Table of Contents (18) Chapters Close

Microsoft Dynamics NAV 2009 Programming Cookbook
Credits
About the author
About the reviewer
1. Preface
1. Strings, Dates, and Other Data Types FREE CHAPTER 2. General Development 3. Working with Tables and Records 4. Designing Forms 5. Report Design 6. Diagnosing Code Problems 7. Roles and Security 8. Leveraging Microsoft Office 9. OS Interaction 10. Integration 11. Working with SQL Server 12. The RoleTailored Client Index

Displaying data from a SQL view in NAV


Most of the data in NAV is stored in tables, but you can also display data from other sources. This recipe will explain how to show data from a SQL View in NAV.

How to do it...

  1. Open SQL Server Management Studio.

  2. Select your database and open a new query window.

  3. Execute the following code:

    CREATE VIEW [Customer Ledger View] AS
    SELECT "Customer No_","Initial Entry Due Date","Posting Date", COUNT_BIG(*) "$Cnt", SUM("Amount") "SUM$Amount", SUM("Amount (LCY)") "SUM$Amount (LCY)"
    FROM "CRONUS USA, Inc_$Detailed Cust_ Ledg_ Entry"
    GROUP BY "Customer No_", "Initial Entry Due Date", "Posting Date"
    
  4. Create a new table from Object Designer.

  5. Add the following fields to the table:

    Field Name

    Data Type

    Length

    Customer No_

    Code

    20

    Initial Entry Due Date

    Date

     

    Posting Date

    Date

     

    $Cnt

    BigInteger

     

    SUM$Amount

    Decimal

     

    SUM$Amount (LCY)

      
  6. Set the following properties on the table.

    Property

    Value

    DataPerCompany

    No

    LinkedObject

    Yes

    LinkedInTransaction...

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 $19.99/month. Cancel anytime
Banner background image