Jump to content
Server Maintenance This Week. ×

Auto enter start date based on end date in a previous record


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

Recommended Posts

  • Newbies

Hi there,

I'm fairly new to Filemaker, but I'm pretty sure there is a solution to what I'd like to achieve. I'm trying to keep a log of hotel rates. The rates are valid for date periods and each date period follows consecutively. To speed up data entry and eliminate errors I feel there is really only a need to enter the end date for each rate period and the start date should be calculated from the previous end date e.g below:

Start Date End Date Rate 01/01/2012 15/01/2012 500 16/01/2012 31/01/2012 400 01/02/2012 20/03/2012 450

The initial start date would need to be entered, but after that the start date in the next record could be calculated from the previous end date i.e. previous end date + 1. I think there must be a way to achieve this with a custom function, but I've scoured the internet for a solution and can't seem to find one.

Any ideas?

Link to comment
Share on other sites

Make StartDate a date field with an autoentered calculation:

Let(

prevEndDate=GetNthRecord ( EndDate ; Get ( RecordNumber ) -1);

if(prevEndDate≠"";prevEndDate+1;"")

)

Link to comment
Share on other sites

  • Newbies

I've just realised that whilst this works perfectly when entering data, there is a flaw if you need to change the end dates. If you change the end dates, the start dates aren't updated automatically when using an auto entered calculation. If I swap the start date to a calculation field this works except for the very first record where the start date can't be calculated. Ideally I'd have an auto enter calculation just for the first record and then the calculated field for the remaining records. I don't think this is possible. Other than having 2 fields, which I don't feel is an elegant solution. Is there a better solution?

Link to comment
Share on other sites

This topic is 4373 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.