Form and temporary table

clembo
Member Posts: 122
I have build a Tabular-Type Form binded to a temporary table.
User can insert in form some record. In the header form I have a textbox in which I want to show total amount (sum of amount field of all row).
How can I do it?
User can insert in form some record. In the header form I have a textbox in which I want to show total amount (sum of amount field of all row).
How can I do it?
0
Comments
-
if you are able to calculate value of all rows for that text box then see how to update header form through line form.
here is many help search forum.0 -
You can write code to consider all the records in the temporary table while INSERT, MODIFY and DELETE and try to find out the sum value and update the form.Veerendra Ch.
http://midynav.blogspot.com/ (Microsoft Dynamics Navision)0 -
Just call function defined on subform from the main form which will calc the sum for you...0
-
I try to explain better:
my table is:
10 "Line No." Integer (Primary Key)
20 "Description" Text
30 "Amount" Decimal
In my form property Autosplitkey=Yes
No subform!
In the Header I show several textbox (binded with some variable).
One of this textbox must to show Total Amount (sum all rows).
In this textbox I insert function called CalcTotalAmount.
This is the code:
IF Rec.FIND('-') THEN
REPEAT
TotalAmount := TotalAmount + Amount;
UNTIL NEXT=0;
EXIT(TotalAmount);
When I run the form and try to insert more than first record:
Error: Tablexxx (my table) "Line no." '10000' already exists.
How I solve it? ](*,)0 -
1) The problem is that you are looping through REC thus changing the position "in background"...
2) Try to restore the original Rec after the loop (backup it at beginning and restore it after that just by :=)RecBackup := Rec; IF Rec.FIND('-') THEN REPEAT TotalAmount := TotalAmount + Amount; UNTIL NEXT=0; Rec := RecBackup; EXIT(TotalAmount);
0 -
Great! Thank you =D>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