Jump to content

Defining calculation_field


This topic is 7384 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hi all,

I have had a look through the posts and cannot seem to find a solution to this problem:

I am using two date fields within an accounting database. The first field is an autofill defined field, which enters the creation date when a new record is created. The second field is a calculation field that simply generates the date today. I have another field called "days_old" which uses a Case() calculation to work out how many days it has been since the creation date (or my invoice date). This all works fine. The problem I have is I would like to define an additional field that displays a result if the value of field "days_old" is greater or equal to 31 but also less than or equal to 60.

Is this possible? Can anyone shed any light..

thanks

P.

Link to comment
Share on other sites

Hello:

Yes this is possible. And with many things in FM there is more than one way to do it grin.gif

What result would you like to display? Either way, the calc would look like this:

Case(Status(CurrentDate) >= Days_old + 31 and Status(CurrentDate) <= Days_old + 60 , "Some Result" , "Some Other Result") ---- You can keep adding conditionals if you want. For example, you may want to show that a date has aged 30 days, 60 or > days, 90, and so on... if you need help with this e-mail me and I can send you more info.

By the way, you shouldn't need a field that calculates the current date, unless you just want to show it on a layout somewhere. But it's not necessary for calculations.

Hope this helped

Ken

Link to comment
Share on other sites

Just a brief addendum to Ken's good advice:

1. The calc will have to be unstored in order to refresh correctly, and

2. The 'result if false' parameter for the Case( ) function is optional - so if, as outlined in your post above, you only require that a result appear when the record falls within the calculated range, the "Some Other Result" part of the formula (and the preceding comma) could be omitted entirely.

Link to comment
Share on other sites

Hi,

I have found the solution to my problem from the advise you have given. Thank you very much!

The calculation I used:

fields:

difference = days since creation_date(or my invoice date).

payment_amount_outstanding = outstanding amount client has to pay.

calculation:

Case(difference >= 31 and difference <= 60, payment_amount_outstanding, "0.00")

This calculation is for a field called 30-61 and simply this field will display the amount outstanding if test1 is a match, or 0.00 if test1 does not match.

many thanks for you help again..

P.

Link to comment
Share on other sites

This topic is 7384 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.