Articles of interest to QuickBase folks
Using "&z="&Rurl() and rdr in formula URL fields
People ask all the time, "What is the "&z="&Rurl() inside some of my QuickBase buttons?". Well, not all the time, but often enough that we should talk about it.
I am referring to formulas that are inside formula URL field buttons like, "Add Task", "Add Document" or "Add Project". It doesn’t matter if records are child or parent records you are creating. Only that you are leaving one location to manually add or edit a record and you wish to return back to the location from which you started.
Many people have edited their Add Record button and figured out that the "&z="&Rurl() seems to return them back to where they started from, but when they try using the function in other formulas it doesn’t work all the time. The reason - it’s not supposed to.
This function was an expedient way for QuickBase engineers to pass a bread crumb from the originating URL into QuickBase so that when you were finished adding or editing a record you would have a way to return to your original starting point.
There are two valid use cases for "&z="&Rurl(). One is when you use the API_GenAddRecordForm and the other is when you use the a=er function to edit a record. Bear in mind that both of these cases expect you to manually modify a record, save the record and return back to the URL from which you started.
Here are two examples of the "&z="&Rurl() use:
An API_GenAddRecordForm Example:
URLRoot() & "db/" & [_DBID_TASKS] & "?act=API_GenAddRecordForm&_fid_48=" & [Record ID#] & "&_fid_8=" & [Est Start Date] & "&z=" & Rurl()
An a=er Example:
URLRoot() & "db/" & Dbid() & "?a=er&rid="&URLEncode([Record ID#])&"&dfid=12"& "&z=" & Rurl()
The thing to remember about the above two examples is that you are starting from one spot, either adding or editing a record, manually saving the record and returning to your starting spot. The "&z="&Rurl() only works in this situation.
If you are using the API_AddRecord or API_EditRecord APIs, the "&z="&Rurl() function won’t work because these APIs don’t expect you to approve or save the record manually. These two APIs perform a function that doesn’t need to be reviewed or saved. The save function is included and processed with no option to manually intervene. Consequently once these APIs are completed they are looking for direction on what to do next. If you don't tell them where to go they will give you an XML response page. This isn't necessarily and error, it is just an unterminated API call. This is where you use an rdr function to either return to some URL or to continue on to perform some other API call.
An rdr= example:
URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&apptoken=b79yg53dmviaxucy3vzvf4actmt&rid=" & [Record ID#] & "&_fid_138=" & 1 & "&rdr=" & URLEncode(URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#])
If we look at what’s included in this example, we start out building the URL that is being launched and add to it the components that make up a valid URL. The URL will include the API, API_EditRecord and includes an optional apptoken and edits the record where rid equals the [Record ID#] field and makes the field with the field id of 138 checked. Field 138 is a checkbox field. After it checks the checkbox it is redirected via the (rdr=) to display the record it just edited. Notice the (a=dr) or display record and the record id or (rid=) is equal to the [Record ID#].
The important distinction is that all of this happened without you having to manually acknowledge what was being added or edited. It was pre-programmed.
Hopefully this has shed some light on the "&z="&Rurl() vs. rdr functionality.
For more information on creating formulas in QuickBase you can review the documentation below, speak with one of our tech support staff or jump into one of the 10 live webinars we hold each week.
Browse by Category
Knowledge Base Categories
- Accounts (31)
- Application (57)
- E-Mail (7)
- Fields (38)
- Forms (18)
- Formulas (18)
- General (72)
- Other Product (7)
- Pages (1)
- Product (5)
- Reports (14)
- Roles (4)
- Search (1)
- Tables (5)