Distinct Flow Fields

rsummers
Member Posts: 9
I am trying to set up a count flow field with this goal in mind. Count how many disctinct occurences of a certain set of criteria happens. For example:
Table data:
Sale # Customer #
TS00001 C0000001
TS00001 C0000001
TS00001 C0000002
TS00001 C0000003
TS00001 C0000003
I need a flowfield set up to tell me how many distinct occuances of customer number there are for the sale number X (in this case TS00001). So the flowfield in this occasion should return 3.
In SQL you could use a SELECT DISTINCT, but no SQL is allowed here.
Any suggestions? <img border="0" title="" alt="" src="images/smiles/icon_confused.gif" />
Ron
Table data:
Sale # Customer #
TS00001 C0000001
TS00001 C0000001
TS00001 C0000002
TS00001 C0000003
TS00001 C0000003
I need a flowfield set up to tell me how many distinct occuances of customer number there are for the sale number X (in this case TS00001). So the flowfield in this occasion should return 3.
In SQL you could use a SELECT DISTINCT, but no SQL is allowed here.
Any suggestions? <img border="0" title="" alt="" src="images/smiles/icon_confused.gif" />
Ron
0
Comments
-
When you add the field set it up as a flowfield in the field properties. Click on the assist button for "CalcFormula" and choose "count" for Method, and the relevant table and filter info. This should work really well for you.0
-
Oops. I re-read your post and realize that the answer I gave you isn't what you were looking for. But I have an idea. Depending on how important this is to you one way that you could do this would be to create a table with the primary key consisting of the fields Sale# and Customer#. You could then add code to the OnInsert trigger of the table from which you want to calculate distinct customers. This code would just try to find the primary key values in the newly created table and would insert a new record only if the value were not found. Back to the original table with the flowfield, you would just set up the flowfield to point to the newly created table. Hope this helps and next time I'll read the post more carefully.0
-
Just remember that Navision's base code does not always fire the OnInsert trigger. For example CodeUnit 333 inserts lines into the Purcase Line table with a simple INSERT, instead of an INSERT(TRUE).
cheers,Matthew Benvenuti
MCP,NCPS,NCSD,NCSQL,WSSL,WSSD,WSWD0
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