Jump to content
muzz

Auto-enter next value in value list for new record?

Recommended Posts

I am just working on an appointment reminder system and I would like to create a set of records each day for the next day's appointments. In general, appointments are half hourly and mostly only one for each timeslot.

I'd like each new record to auto-enter the appointment time 1 slot (30mins) later than the time slot in the previous record.

At the moment the timeslots are in a value list from 8.00AM to 5.00PM in 30min intervals. Once I've created the record for the 10.30AM slot I'd like the next record to auto-enter as 11.00AM etc. My current method is to do it by calculation from the time data in the timeslot field from the previous record by using the value of the n-1th record (where n is the total number of records) and adding 30 mins but this feels more complicated than perhaps it might need to be.

If ( Get ( RecordNumber ) =1; "8:00 AM" ;GetAsTime (GetNthRecord ( Time ; Get ( RecordNumber ) -1 )) + GetAsTime ("00:30:00"))

Is it simpler (or possible) just to select from the values in a value list?

Thanks.

Edited by muzz
Typo

Share this post


Link to post
Share on other sites

Hello

You could get the values from your value list using GetValueListItems and then go through a loop creating new records and taking the next value from the list of values to set for each new record. This way, it would be more flexible in the future as you could just change the value list if your appointment slots changed, and the script would continue to work without modification.

I've done a little sample file to show you what I mean.

Try running the script within, and it will create new records from the value list.

Value Lists.fmp12.zip

Share this post


Link to post
Share on other sites

Thanks rwoods. I probably didn't give as much information as I should have.

The appointment calendar is not integrated into Filemaker, we are using Apple Calendars on a Mac. The current workflow would be to manually create one reminder record at a time, enter the appointment time and enter the client code which would then pull the mobile number in and create the message to be sent.

Not all clients have a mobile or wish to receive a reminder, or an appointment slot may not be filled so not all time slots will be used. Sometimes the appointments may start later in the day or vary for some other reason.

I just thought it would be easier to select an appointment closer to the last appointment made in the drop down value list rather than defaulting to the start time or any other time for that matter if entering the field if it is necessary to change the time.

Thanks for your solution though - I may have use for it in another table and appreciate your effort.

 

Share this post


Link to post
Share on other sites

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

×

Important Information

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