Flowfield for a MAX value- Sorting

poppins
Member Posts: 647
Hi everyone,
I created a custom flowfield with the following calcformula:
Max(TabXxx."Posting Date" WHERE (Customer No.=FIELD(Customer No. Filter)))
whrere "Customer No. Filter" is a flowfilter.
When "Customer No. Filter" consists of a single customer no., the flowfield returns a correct value for the max date.
But when there are several customers in the filter, the flowfield returns a wrong value.
It looks like it is sorting by customer and getting the max date for the last customer in the filter...
Does it really work this way?
Thanks in advance
I created a custom flowfield with the following calcformula:
Max(TabXxx."Posting Date" WHERE (Customer No.=FIELD(Customer No. Filter)))
whrere "Customer No. Filter" is a flowfilter.
When "Customer No. Filter" consists of a single customer no., the flowfield returns a correct value for the max date.
But when there are several customers in the filter, the flowfield returns a wrong value.
It looks like it is sorting by customer and getting the max date for the last customer in the filter...
Does it really work this way?
Thanks in advance

0
Best Answers
-
Been a while since I dealt with that one, but I believe the FlowField will use the first available key in the list that is capable of calculating the value.5
-
You cannot control key in Flowfield calculation , you have to write code to populate that value.5
Answers
-
How you are passing your filters, I tried it by passing two Customer No's 10000|20309920 or 10000..20309920 and it returns correct date with the same CalcFormula.
I populated this data on my Table
Customer No. || Posting Date
10000 || 01-01-2016
20000 || 07-01-2017
10000 || 03-01-2017
20309920 || 04-01-2017
After both filters it returns 07-01-2017
PK of my table was Entry No.0 -
rishi_rishabh123 wrote: »How you are passing your filters, I tried it by passing two Customer No's 10000|20309920 or 10000..20309920 and it returns correct date with the same CalcFormula.
I populated this data on my Table
Customer No. || Posting Date
10000 || 01-01-2016
20000 || 07-01-2017
10000 || 03-01-2017
20309920 || 04-01-2017
After both filters it returns 07-01-2017
PK of my table was Entry No.
I am displaying the flowfield on a page based on the table of the flowfield and I am passing the filters within the OnOpenPage and the OnAfterGetCurrentRecord triggers of that page...
I wrote a custom code for this:
SETFILTER("Customer No. Filter", GetCustomerNoFilter(FieldX));
GetCustomerNoFilter is a function that calculates the filter...
The filter value is correct, I tested it many times, but the flowfield returns a correct value only when there is just one customer number in the filter...
How did you pass your filters to get a correct result?
0 -
You can use any of following :
//TEST
SETFILTER("Customer No. Filter",'10000..20309920');
CALCFIELDS("Custom Date Field");
//TEST
//TEST
SETFILTER("Customer No. Filter",'10000|20309920');
CALCFIELDS("Custom Date Field");
//TEST
Make sure that you are using calcfields or SETAUTOCALCFIELDS for your flow fields.
let me know if you have any questions.0 -
rishi_rishabh123 wrote: »You can use any of following :
//TEST
SETFILTER("Customer No. Filter",'10000..20309920');
CALCFIELDS("Custom Date Field");
//TEST
//TEST
SETFILTER("Customer No. Filter",'10000|20309920');
CALCFIELDS("Custom Date Field");
//TEST
Make sure that you are using calcfields or SETAUTOCALCFIELDS for your flow fields.
let me know if you have any questions.
I figured out the source of the problem...
I have a key in my table "Customer No.","Posting Date". It looks that the flowdfield is using this key for its sorting and that is why it gives sometimes a flase value...
Is there a way to control the key the flowfield is using?
0 -
Been a while since I dealt with that one, but I believe the FlowField will use the first available key in the list that is capable of calculating the value.5
-
You cannot control key in Flowfield calculation , you have to write code to populate that value.5
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