Forum Discussion
AlexCertificati
7 years agoQrew Cadet
What's the formula?
WayneMajor
7 years agoQrew Cadet
The formula for the field Total Quantity is as follows:
var date FirstDayOfTheMonth = FirstDayOfMonth(Today()) ;The quantity Received as well as quantity used are just input fields that have no formula.
If(Today() = $FirstDayOfTheMonth or IsNull([Supply - Updated Quantity]), [Supply - Total Quantity] , [Supply - Updated Quantity] )
// If an order is being made at the beginning of the month, than the quantity will use the beginning month value, if the order is being made at any other date or if there is no updated quantity yet, the initial quantity will be used
The [Supply - Updated Quantity] field resides in the related table called Supply Record and will remain null until it is updated by a order in Supply Management.
[Supply - Updated Quantity] has a formula that looks like this:
_Starting out, this value should be null since it has yet to be updated, as a falisafe, the [Total Quantity (Beginning of the Month)] field is used in its place. Ive tried to cover all areas so that even if a field is left blank or null, there should always be some number being returned. The thing that really confuses me is that all my formulas are working as expected yet occasionally the [Current Quantity] field will simply not save the data it receives thorugh its formula, it WILL display it (sometimes), but if you exit the order or save it, and then go back into it the data for that field only will disappear and break everything.
[Order - Current Quantity]