SETSELECTIONFILTER for table sum?

Holzwurm
Member Posts: 1
Hi,
i like to add a small code to a Form. Goal: the user select 1 to ? lines in a table and under the table i have a sum for this selection.
OnAfterGetCurrRecord:
CurrForm.SETSELECTIONFILTER(TerminBauteil2);
dickesum := 0;
IF TerminBauteil2.FINDSET THEN
REPEAT
dickesum += TerminBauteil2."Dicke (mm)";
UNTIL TerminBauteil2.NEXT = 0;
Problem: The sum is not correct. Most times the last selected or deselected row is not included. Or if i select 4 Lines at once i have only the sum for 1 Line... after clicking on another line the sum is from the last 4 lines?!
If i put the code on a extra button, it is working. It Looks like the table have to lost the Focus for exact Response?
Have somebody a trick or Workaround for this?
NAV Version 4.0
many thanks
Mathias
i like to add a small code to a Form. Goal: the user select 1 to ? lines in a table and under the table i have a sum for this selection.
OnAfterGetCurrRecord:
CurrForm.SETSELECTIONFILTER(TerminBauteil2);
dickesum := 0;
IF TerminBauteil2.FINDSET THEN
REPEAT
dickesum += TerminBauteil2."Dicke (mm)";
UNTIL TerminBauteil2.NEXT = 0;
Problem: The sum is not correct. Most times the last selected or deselected row is not included. Or if i select 4 Lines at once i have only the sum for 1 Line... after clicking on another line the sum is from the last 4 lines?!
If i put the code on a extra button, it is working. It Looks like the table have to lost the Focus for exact Response?
Have somebody a trick or Workaround for this?
NAV Version 4.0

many thanks
Mathias
0
Answers
-
There is no trigger that gets called on selection events. It looks like the line is (lines are) not yet selected when the OnAfterGetCurrRecord trigger is fired. Moreover, this trigger probably does not get called at all if the line has the focus even before it gets selected.
I don't think there is any way of achieving correct automatic calculation other than by using a timer, or some other automation with events.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