Create an appointment for next week
Hi All,
I have a button in a Dashboard to create an appointment and popup the new record.
The new Appointment record has the date field set for Today as the default. It works fine.
I have tried to create 2 similar button formulas that will create the record with tomorrows date and one with next weeks date( today() +7) without success.
I would appreciate some suggestions—thanks for looking!
Sam
11 replies
-
Hi Sam one question how you resolve the button to create a appointment.
let term := text(appointment(datetime(Date, From), 'Time Internal')); do as server Appointment := term end
I try this but don't work
-
This works for me:
Appointment := appointment(datetime(Date + 7), 3600000 * 4)
Appointment is my appointment field.
appointment() is the command to set an appointment field.
Date is a date field.
3600000 is the number of milliseconds in an hour so I'm adding 4 hours to start time
You can also do:
Appointment := appointment(datetime(today() + 7), 3600000 * 4)
-
said:
You will see that the default method of making the appointment is with a plain Date field. I'm hoping to have the buttons create an appointment for tomorrow and one for next week. There is a formula within each button. On my end, they create an appointment for today only.Take a look at the Ninox docs for appointment().
So the format is:
appointment(start, end) or appointment(start, duration) To convert 2 given time-related values to an appointment.
So my reply shows an example of (start, duration).
Your code is missing this format, and a couple of other typos. You wrote:
let newRec := (create APPOINTMENTS); APPOINTMENTS.(Appointment := date(today()) + 1); openRecord(newRec)
1) If you want to modify the Appointment field of the newly created record then you need to reference that variable in line 2.
let newRec := (create APPOINTMENTS); newRec.(Appointment := date(today()) + 1); openRecord(newRec)
2) Now you need to add the appointment() command to line 2 so you can add an appointment. We will follow the appointment(start, duration) format for the Create Tomorrow's Appointment button:
let newRec := (create APPOINTMENTS); newRec.(Appointment := appointment(datetime(today() + 1), 3600000 * 4)); openRecord(newRec)
You can change the + 1 to +7 for the Next Week button.
-
said:
Also, I can not see why the +1 needs to be +2. And the +7 needs to be +8 for the date to be moved forward 1 and 7 days respectively.I'm not sure what you mean. When I use today() + 1 it gives me tomorrow.
Content aside
- Status Answered
- 8 mths agoLast active
- 11Replies
- 105Views
-
3
Following