Days Difference

alien251
Member Posts: 80
Hello,
I want to add a flowfield that shows the number of days between two dates, how can I do this?
Thanks,
Dan
I want to add a flowfield that shows the number of days between two dates, how can I do this?
Thanks,
Dan
0
Comments
-
Why a flowfield?
You just need a variable. Is it for a report? A form? Do you want this value stored at a table?0 -
-
FlowFields are designed for sums, lookups, averages, etc. The real basics.
You should add a new field, and then update it when one of the date fields is changed. You can add code to the OnValidate trigger for both.0 -
You can display the dates dynamically if you put the code on the form as well.Confessions of a Dynamics NAV Consultant = my blog
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book0 -
I would never put this code on the form. I would probably create a function in the table that returns the number of days as an integer based on two date fields in that table, and have a textbox on the form with the function as its sourceexpr.0
-
I appreciate all of the input!
Doesn't have to be a FlowField but the dates on the table that will be used in the calculation will be flow fields. It's for display only, my finance people will be exporting the data into Excel and running the data through some forecasting tools. The calculation needs to be performed from the Production Order List. I've already added a flow field that looks up the original order date from the sales order archive (since the SO doesn't exist anymore after invoicing, does this pain anyone else?). The forecasting formula needs to know the number of days between the order date and the finished date. Is there something similar to the sql DATEDIFF in Navision that I can use to seed the variable I'll display in the list?
I looked through Chapter 17: Using Intrinsic C/AL Functions and searched the forum here...
Ideas...???
Thanks!!
Dan0 -
DateOne - DateTwo = Integer;
With these things you have to try some things. What I always do is put a test form together, in every project I work on I have these test forms with little code snippets to try out different types of calculations, to see what happens with the code. Put some textboxes on it with date variables as sourceexpr. Put a button on there and write some C/AL code in the OnPush event that calculates the difference between the two, and puts the results in a message. Read what the error messages tell you.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