Using a formula-URL field | INTERMEDIATE
Formula-URL fields are a great way to create custom links, helping users navigate to forms and pages within and outside of Quickbase. Here are a few examples:
✓ Create urls to your company profile page
✓ Switch from one form to another
✓ Update a record
Let’s go through these examples one at a time:
- Example: Create urls to your company profile page
Say your company stores a biography of each employee on its public website. The link to each profile follows a similar file path (ex. www.mycompany.com/profiles/tina_bradley). In this case ‘tina_bradly” at the end of the URL will direct the user to Tina Bradley’s profile
Using an employee’s [FirstName] and [LastName] from their employee record you can construct a URL-Formula creating a link on each employee’s profile using following formula:
"www.mycompany.com/profiles/" & [FirstName] &”_”& [LastName]
The first part of the formula is hard coded with ‘www.mycompany.com/profiles/’. Then we’re use the ‘&’ symbol to append the root url with the employee’s [FirstName]. Then we add an underscore with ‘&”_”’. Last we add the last name to the URL string with ‘& [LastName]’
- Example: Switch from one form to another
In this case, suppose you have a table where your company stores time cards. You’d like to show different fields depending on whether the timecard is for regular hours or time-off. In this case you can create one form for ‘regular’ time cards and a different form for ‘time-off’ time cards. Once you’ve created your two forms you can create your formula-URL field:
- Create a formula-URL field
- Name the field ‘Time-off’
- In the formula area paste this formula: URLRoot()&”db/”&Dbid()&”?a=dr&rid=”&ToText([Record ID#])&”&dfid=YOUR_FORM_ID”
- Once you have your two forms created, open the time card table ‘settings’ and locate the form ID# of your ‘time-off’ form
- Update your formula in step 3 by replacing the last section (YOUR_FORM_ID) with the form ID# you just located. Your formula should now look something like this:
- Now go to your ‘regular’ time card form and place the formula-URL field you’ve just created on the bottom of the form.
- Now let’s look at what our formula is doing in each component part:
- urlroot(): your quickbase root URL (https://companyname.quickbase.com)
- “db/”: in every QBase URL
- dbid(): table ID where you’re adding this field
- “?a=dr: Action = Display Record
- rid=”: tells Quickbase to look for the Record ID
- [record ID#]: brings in the record ID field
- “&dfid=5”:tells the formula to use the form with formID 5
- Example: Modify a record by clicking the URL button
One great feature of formula-URL fields (and Rich Text fields) is the ability to create buttons, which can incorporate api capabilities, which include things like modifying or adding records. Let’s say your company has a number of projects. When a project is complete, you’d like the project manager to open the record and click a button to mark the project complete.
In this example we’ll create a checkbox field called ‘Project Complete’. When checked, the project will be considered complete. Then we’ll create another field to store our button. When the button is clicked it will check the ‘Project Complete’ field.
- Create a checkbox fields and name it ‘Completed’
- Create a new formula-URL field. Name it: ‘Mark Project Complete’
- Add the following text to you formula:
URL=URLRoot() & "db/" & Dbid() & "?act=API_EditRecord"& "&rid=" & URLEncode ([Record ID#])& "&_fid_Your Field ID=1" & "&apptoken=" & "Your app token";
- Now replace ‘Your Field ID’ with the ID of your ‘Completed’ checkbox field and ”Your app token” with the application token from your Quickbase App
So why create a button to check ‘Project Complete’ checkbox field? Why not just have the user click the checkbox? First, by creating a workflow of button, you can make actions, such as completing a project, more explicit to users. Second, this is just a basic example that can be used as a building block for more sophisticated buttons. For example, your formula might stipulate that the button be shown on a record only if certain conditions are met. For instance the button might only appear on a project if that project has already been awarded.
EDITORS NOTE: Formula-URL fields are synonymous with ‘Buttons’. A formula-URL can either be read as its URL string or can be converted into button format within field settings.
Visit here to demo examples in this article: https://quandarycg.quickbase.com/db/bn22wn4cx?a=dr&r=e.
- Author: Jake Rattner (firstname.lastname@example.org)
- Date Submitted: 12/19/2018