Get Highest amount in customer ledger entry

karuchua
Member Posts: 151
hi all,
am trying to write a function to get the highest amount in the customer ledger entry table
how do i get this?
am trying to write a function to get the highest amount in the customer ledger entry table
how do i get this?
0
Answers
-
Hi
first of, where do you need it? in a table? then make a flowfield.
in a function?
loop trough the records:local variable maxEntry , type Record // RANGES IF Findset then repeat IF (Amount > maxEntry.Amount) THEN maxEntry := Rec; until next() = 0; // maxEntry now contains the record with the highest amount
cheersGreetings from Switzerland0 -
i have tried this but not working
LCustREC.INIT; IF LCustREC.GET(PAccNo) THEN BEGIN LCustREC.CALCFIELDS("Balance (LCY)"); IF LCustREC."Balance (LCY)"<0 THEN BEGIN LCustLedgEntryREC.RESET; LCustLedgEntryREC.SETCURRENTKEY("Customer No.","Posting Date","Document Type"); LCustLedgEntryREC.SETRANGE("Customer No.",PAccNo); LCustLedgEntryREC.SETFILTER("Document Type",'%1',LCustLedgEntryREC."Document Type"::Payment); LCustLedgEntryREC.SETRANGE(Open,TRUE); // LCustLedgEntryREC.SETFILTER("Posting Date",'%1..%2',LDate,PAgeingDate); IF LCustLedgEntryREC.FINDSET THEN REPEAT IF (LCustLedgEntryREC."Amount (LCY)">LAmount) THEN LAmount:=LCustLedgEntryREC."Amount (LCY)"; UNTIL LCustLedgEntryREC.NEXT=0 END END
0 -
Hi
Amount LCY is a flowfield, you have to calculate it everytime.... repeat LCustLedgEntryREC.calcfields("Amount (LCY)") IF (LCustLedgEntryREC."Amount (LCY)">LAmount) THEN LAmount:=LCustLedgEntryREC."Amount (LCY)"; until LCustLedgEntryREC.NEXT() = 0;
If you're using NAV13 I think you could use setautocalcfieldsGreetings from Switzerland0 -
What are you looking for when you say Highest Amount?
Are you looking for the largest individual order?
Are you looking for the customer with the Largest Balance?
Are you looking for the customer with the Largest Sales?
Have you looked at the Report "Top __ Customer List"?0 -
am looking for the customer with the highest negative balance?0
-
Did you try the top customer list?
Are you saying you have over 100 customers with a negative balance?
else you can under Customer tab Balance (lcy) <0
options tab select balance (lcy).
If this was something that we needed on a regular basis. I would probably create a report that exports to excel & in the click of a button sort is as I would like.0 -
Savatage wrote:Did you try the top customer list?
Are you saying you have over 100 customers with a negative balance?
else you can under Customer tab Balance (lcy) <0
options tab select balance (lcy).
If this was something that we needed on a regular basis. I would probably create a report that exports to excel & in the click of a button sort is as I would like.
This report is only available in the NA version.Confessions of a Dynamics NAV Consultant = my blog
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book0 -
I think Harry is talking about Report 111 which should be available in W1."Money is likewise the greatest chance and the greatest scourge of mankind."0
-
Just trying to figure out the easiest & fastest way to achieve his goal.
We also don't know how often he will need such a list.
If 'once in a while' then no need to get into coding & sorting & arrays, etc.
Finding an existing report that can accomplish this task would be great.
Also, You could easily add "Balalce (Lcy)" to the customer list (if not already).
Filter on <0 & copy & paste the results into excel.
Highest Negative Balance0 -
thank you for the contributions, i managed to get the highest negative balance.
but as you will note, in the code below, am using that value to get another valueIF LCustLedgEntryREC.FINDFIRST THEN REPEAT LCustLedgEntryREC.CALCFIELDS("Amount (LCY)"); LAmount:=LCustLedgEntryREC."Amount (LCY)"; IF (LCustLedgEntryREC."Amount (LCY)">LAmount) THEN Engineer:=LCustLedgEntryREC."Job No./Sales Engineer Name" ELSE Engineer:=LCustLedgEntryREC."Job No./Sales Engineer Name"; UNTIL LCustLedgEntryREC.NEXT()=0 ;
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