Temporary table, Form and FlowField

Eddie
Member Posts: 26
HI! Is anybody know a sulution for my problem? So it is...
I run the form on Temporary table. For example:
SalesLineTMP is defined as Temporary Table in Globals.
SalesLine.SETRANGE("Document No.","No.");
SalesLine.SETRANGE("Document Type," "Document Type");
IF SalesLine.FIND('-') THEN
REPEAT
SalesLineTMP.INIT
SalesLineTMP.TRANSFERFIELDS(SalesLine);
SalesLineTMP.INSERT;
UNTIL SalesLine.NEXT = 0;
FORM.RUN(12345,SalesLineTMP);
It works very nice!
When the Form is open, I can see inserted records. I can do some modifications for example changed the quantity or Unit price....
The result is that "Line Amount" is change as well. It is OK.
What I need is:
I need calculate "Line Amount" on all records shown in form. I need it use for something like a Statistics F9. How? Flowfield doesn't work... THX
I run the form on Temporary table. For example:
SalesLineTMP is defined as Temporary Table in Globals.
SalesLine.SETRANGE("Document No.","No.");
SalesLine.SETRANGE("Document Type," "Document Type");
IF SalesLine.FIND('-') THEN
REPEAT
SalesLineTMP.INIT
SalesLineTMP.TRANSFERFIELDS(SalesLine);
SalesLineTMP.INSERT;
UNTIL SalesLine.NEXT = 0;
FORM.RUN(12345,SalesLineTMP);
It works very nice!
When the Form is open, I can see inserted records. I can do some modifications for example changed the quantity or Unit price....
The result is that "Line Amount" is change as well. It is OK.
What I need is:
I need calculate "Line Amount" on all records shown in form. I need it use for something like a Statistics F9. How? Flowfield doesn't work... THX
0
Comments
-
You will need a function to read all records in the file to do that.
When you get into your function, you have to save the current record, all it's filters and the currentkey. Then you can do a RESET and read all records to make your total, and then you have to restore the current record,filters and currentkey.
Some exemple:Function CalculateLineAmount : OdecLineAmount : Decimal LrecSalesline.TRANSFERFILTERS(Rec); LrecSalesLine := Rec; OdecLineAmount := 0; RESET; IF FIND('-') THEN REPEAT OdecLineAmount += "Line Amount"; UNTIL NEXT = 0; TRANSFERFILTERS(LrecSalesline); Rec := LrecSalesLine;
PS : don't useFORM.RUN(12345,SalesLineTMP);
But useFORM.RUN(FORM."My Form",SalesLineTMP);
This is better when you have to do an upgrade,merge or someone else has to read your code.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!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