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.
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...
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.
Comments
You just need a variable. Is it for a report? A form? Do you want this value stored at a table?
RIS Plus, LLC
MVP - Business Apps
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.
My Blog - nav.education
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book
RIS Plus, LLC
MVP - Business Apps
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!!
Dan
RIS Plus, LLC
MVP - Business Apps