web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Find "Remaining Amount" through SQL query.

(1) ShareShare
ReportReport
Posted on by 1,893

Dear Experts,

How to retrieve the "Remaining Amount" from "Vendor Ledger Entry" table with help of SQL server. It is a flowfield.
I am trying to retrieve it help of [XYZ Private Limited$Detailed Vendor Ledg_ Entry] table but always comes the wrong value.

Please help me to short this. My sql query is below.

select sum(DVLE.Amount) "Remaining Amount",VLE.[Document No_],VLE.[Document Date],VLE.[Currency Code],VLE.[Vendor No_],[XYZ Private Limited$Vendor].Name "Vendor Name"
from [XYZ Private Limited$Vendor Ledger Entry] VLE
left outer join [XYZ Private Limited$Detailed Vendor Ledg_ Entry] DVLE on DVLE.[Document No_] = VLE.[Document No_]
and DVLE.[Vendor No_] = VLE.[Vendor No_] and DVLE.[Vendor Ledger Entry No_] = VLE.[Entry No_] and DVLE.[Posting Date] = VLE.[Posting Date]
left outer join [XYZ Private Limited$Vendor] on [XYZ Private Limited$Vendor].No_ = VLE.[Vendor No_]
where VLE.[Document Type] = 2 and DVLE.[Document Type]=2 and DVLE.Amount >0
and VLE.[Vendor No_] = 'V-DO-0451' and VLE.[Document No_] ='GV-101-16-11-111'
group by VLE.[Document No_],VLE.[Document Date],VLE.[Currency Code],VLE.[Vendor No_],[XYZ Private Limited$Vendor].Name

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Community Member Profile Picture
    on at
    RE: Find "Remaining Amount" through SQL query.

    Thi sblog will inspire you to find the correct SQL query:

    https://blogs.msdn.microsoft.com/melyassir/2009/12/28/astuces-5-comment-rcuprer-la-requte-sql-pour-calculer-les-flowfields/

    The blog is in French and for NAV 2009 ;)

  • Community Member Profile Picture
    on at
    RE: Find "Remaining Amount" through SQL query.

    Hi MKY,

    Remaining amount filed is sum index field which is calculated from amount filed ,it wont store in vendor ledger entry table(database) this is virtual filed not real.

    Thank you

  • manish.yadav Profile Picture
    1,893 on at
    RE: Find "Remaining Amount" through SQL query.

    Hi Ashwini,

    Thank you for your reply i got a solution.

    Thank you.

    Please close this thread.

  • Veeravi Profile Picture
    5 on at
    RE: Find "Remaining Amount" through SQL query.

    Hi NAV Beginners,

    how did you solve this isssue we are also trying to get the sql query for vendor and customer with "remaining amount"

    Tks rgd

    Vee

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

#1
Saurav.Dhyani Profile Picture

Saurav.Dhyani 2 Super User 2025 Season 2

#2
RK-25090803-0 Profile Picture

RK-25090803-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans