Forum Discussion
MCFNeil
8 years agoQrew Captain
Pedro,
You will want to use the API_AddRecord function in a formula URL to get the new records added / click.
For simplicity sake, I'm going to assume you just have 2 tables.
Parent Table: Employee Requests
Child Table: Days Off
You make a request with that has a [Start Date], and an [End Date].
On the [_Days_Off] table you will have a [Date] field and also relate it to the [_Employee_Requests]
In the relationship make a summary field that summarizes the maximum [Date] of the Day Off.
You will then need to use that [Max Day Off Date] and add one day to it.
Make a formula date field called [Next Day Off], and the equation would be.
But if [Max Day Off Date] is blank (i.e. its your first record to be made) you need to account for that.
Now that you have the set up together, you can work on the formula-url.
Just mapping the Record ID# to the [Related Request] and the Next Day Off to the [Date] field.
You will need a refresh between each click, as to get the most updated max date. So it might look something like this.
I hope that helps. Its not my favorite, but if you really can't use script, and need a shortcut to creating multiple records. This will do it with minimal set up time.
You will want to use the API_AddRecord function in a formula URL to get the new records added / click.
https://<em>target_domain</em>/db/<em>target_dbid</em>?a=API_AddRecord&apptoken=<em>app_token<br></em>
&_fid_6="&URLEncode([Record ID#)
&"&_fid_8="&URLEncode([Next Day Off])
For simplicity sake, I'm going to assume you just have 2 tables.
Parent Table: Employee Requests
Child Table: Days Off
You make a request with that has a [Start Date], and an [End Date].
On the [_Days_Off] table you will have a [Date] field and also relate it to the [_Employee_Requests]
In the relationship make a summary field that summarizes the maximum [Date] of the Day Off.
You will then need to use that [Max Day Off Date] and add one day to it.
Make a formula date field called [Next Day Off], and the equation would be.
[Max Day Off Date]+Days(1)
But if [Max Day Off Date] is blank (i.e. its your first record to be made) you need to account for that.
If(IsNull([Max Day Off Date]), [Start Date], [Max Day Off Date]+Days(1))
Now that you have the set up together, you can work on the formula-url.
Just mapping the Record ID# to the [Related Request] and the Next Day Off to the [Date] field.
You will need a refresh between each click, as to get the most updated max date. So it might look something like this.
var text URL=https://<em>target_domain</em>/db/<em>target_dbid</em>?a=API_AddRecord&apptoken=<em>app_token</em><br>&_fid_6="&URLEncode([Record ID#)<br>
&_fid_6="&URLEncode([Record ID#)
&"&_fid_8="&URLEncode([Next Day Off])<br>
;
"javascript:" &
"$.get('" &
$URL &
"',function(){" &
"location.reload(true);" &
"});"
& "void(0);"
I hope that helps. Its not my favorite, but if you really can't use script, and need a shortcut to creating multiple records. This will do it with minimal set up time.