Sum Amount After filter

klum
Member Posts: 102
Hi All,
Maybe my problem is easily for somebody..
I am working on NAV4.0Sp3. I created new form which have :
TabControl
- There are three filter variables are DateFilter,DocumentFilter and
VendorFilter
TableBox (Purchase Line)
- This tableBox where will show information when customer selected any filters
TextBox (TotalVatAmount-Decimal)
- My problem from this variable.
My question is How I can sum Amount field after I put some filters already and update TextBox Control???? ](*,)
Any help I will appreciate...Thank in advance
Wanvisa
Maybe my problem is easily for somebody..

I am working on NAV4.0Sp3. I created new form which have :
TabControl
- There are three filter variables are DateFilter,DocumentFilter and
VendorFilter
TableBox (Purchase Line)
- This tableBox where will show information when customer selected any filters
TextBox (TotalVatAmount-Decimal)
- My problem from this variable.
My question is How I can sum Amount field after I put some filters already and update TextBox Control???? ](*,)
Any help I will appreciate...Thank in advance

Wanvisa
0
Answers
-
Hi Wanvisa,
I had a similar problem to this a couple of days ago and I created a function in the form to get around it. Your function would resemble the following:CalcTotalVat() TotalVat : Decimal TotalVat := 0; PurchLine.RESET; PurchLine.SETFILTER("Order Date", GETFILTER("Order Date")); PurchLine.SETRANGE("Vendor No.",GETFILTER("Vendor No.")); PurchLine.SETRANGE("Document No.",GETFILTER("Document No.")); IF PurchLine.FIND('-') THEN BEGIN REPEAT BEGIN TotalVAT += PurchLine."VAT Amount"; END; UNTIL PurchLine.NEXT = 0; END; EXIT(TotalVat);
PurchLine is a local variable in the function
You then just need to call this function from the appropriate point in your process to refresh the TotalVatAmount field.
(e.g. TotalVATAmount := CalcTotalVat;)
Hope this helps
Richie0 -
Hi Richie :P
Thank a lot for your fast answer to me...
I put this function CalcTotalVat onValidate each filter variable so I wrote code like this:Function CalcTotalVat TotalVATAmount := 0; SETFILTER("Posting Date",DateFilter); SETFILTER("No.",DocumentFilter); SETFILTER("Buy-from Vendor No.",VendorFilter); SETFILTER("Wagon No.",WagonFilter); IF FINDFIRST THEN REPEAT TotalVATAmount += "Item Charges VAT Amount"; UNTIL NEXT = 0;
Now It's work well ....Thanks again
Best Regards,
Wanvisa0
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