A question in the Quickbase community asked about a parts binder (original thread here). The app has an Inventory table with an Inventory Usage child table. The asker already had a quickchart.io QR code that opened the part's record. What they wanted was a code that skips the part and goes straight to a new Inventory Usage form for that part. Then anyone can scan a label in the binder, enter what they took, and save.
You can do this with one formula field. The QR code holds an "add record" URL for the child table, and that URL fills in the reference field with the part's Record ID#. One detail decides whether it works: the URL has to be encoded before it goes inside the quickchart.io link. That's covered in Step 3.
I built this in a sandbox app with an Inventory table and an Inventory Usage table to check it. The formulas below come from that build, and I scanned the generated codes to make sure they hold the right URL. The part data is made up.
What we're working with
- Inventory (parent): one record per part, with fields like Part Name, Part Number and Starting Quantity.
- Inventory Usage (child): one record each time someone takes parts, with Quantity Used, Checked Out By, and the reference field Related Inventory that links it to the part.
If you already have a relationship between the two tables, you're set. If not, create one in the Inventory Usage table's settings under Table-to-table relationships, with Inventory as the parent. Quickbase creates the Related Inventory reference field for you.
Step 1: Find the field ID of the reference field
The URL fills in a field by its ID, not its name, so you need the ID of Related Inventory on the Inventory Usage table.
- Open the Inventory Usage table's settings and go to Fields.
- Find Related Inventory. The field ID appears in the ID column of the fields list. You can also open the field and read the ID on its properties page.
In my sandbox it was field 8. In a new child table it's often a low number like 6, 7 or 8, but check yours. If you guess wrong, the form still opens and the part just won't be filled in.
Step 2: Find the table alias for Inventory Usage
The formula lives on Inventory but has to point at the Inventory Usage table. You don't hard-code that table's ID. You use its table alias, which looks like [_DBID_INVENTORY_USAGE].
- Open the Inventory Usage table's settings and look under Advanced settings. The alias is listed there.
- The alias is built from the table name in capitals, with spaces and punctuation turned into underscores. In my sandbox, a table named "Blog Demo - Inventory Usage" got the alias
_DBID_BLOG_DEMO___INVENTORY_USAGE(three underscores where " - " was). Look yours up rather than typing it from memory.
Using the alias instead of the raw table ID means the formula keeps working if you copy the app.
Step 3: Create the QR code field
On the Inventory table, add a new field:
- Type: Formula - Rich Text
- Name: something like "Check Out QR"
Rich Text is the type that renders HTML, which is what turns the <img> tag into a picture. When I created the field in the sandbox, HTML rendering was on by default. If you see the raw <img src=...> text on your form instead of an image, check that the field is Formula - Rich Text and not Formula - Text.
Paste this formula. Swap 8 for your Related Inventory field ID and use your own table alias:
var text AddUsage = URLRoot() & "db/" & [_DBID_INVENTORY_USAGE]
& "?a=API_GenAddRecordForm&_fid_8=" & [Record ID#];
"<img src='https://quickchart.io/qr?size=150&text=" & URLEncode($AddUsage) & "'>"
Here's what each piece does:
URLRoot()returns your realm's address, likehttps://yourcompany.quickbase.com/, so the formula works in any realm.a=API_GenAddRecordFormopens the standard add-record form for that table._fid_8=plus[Record ID#]fills in Related Inventory with this part's Record ID#, so the new usage record is already linked to the right part.- The last line puts that URL inside a quickchart.io image link, which returns a QR code.
Why URLEncode() matters
The add-record URL has its own & in it (&_fid_8=...). If you drop it straight into the quickchart.io link, quickchart.io reads that & as the start of one of its own parameters. Everything after it gets cut off the QR code.
I tested both versions by scanning the codes:
| Formula | What the QR code actually contains |
|---|---|
With URLEncode($AddUsage) | https://…/db/<table>?a=API_GenAddRecordForm&_fid_8=1 |
Without URLEncode() | https://…/db/<table>?a=API_GenAddRecordForm (no part) |
Without encoding, the form still opens, but it's blank and nothing ties the new record to the part. That's easy to miss when you test, so scan a code and check that the part is filled in.
With the formula saved, the first part in my sandbox produced this value:
<img src='https://quickchart.io/qr?size=150&text=https%3A%2F%2Fwebapp.quickbase.com%2Fdb%2F<table id>%3Fa%3DAPI_GenAddRecordForm%26_fid_8%3D1'>
All of the &, ? and = signs inside the add-record URL come out encoded (%26, %3F, %3D), which is what you want.
Step 4: Check it on a phone
- Open a part record and you should see the QR code on the form. If the field isn't on the form, add it in the form builder.
- Scan it with a phone camera and tap the link.
- You should land on a new Inventory Usage form with Related Inventory already set to that part. Any lookups, like the part name, fill in too.
- Enter Quantity Used and who took it, then save.
A few things about how this behaves on a phone:
- People have to be signed in to Quickbase in the phone's browser. If they aren't, they get the sign-in page first. The QR code holds a plain link with no credentials, which is how it should be. Never put a user token or app token in a printed code.
- Normal permissions still apply. Whoever scans needs permission to add Inventory Usage records.
- In my sandbox the old-style
db/...?a=API_GenAddRecordFormlink redirected to the newer Quickbase page and kept the_fid_8value, so the part was still filled in. - Quickbase won't save an add form opened this way unless something on it changes. That's not a problem here, because people always enter a quantity. Just don't expect a form that's already completely filled in to save without an edit.
Step 5: Print labels for the binder
A 150-pixel code is fine on screen, but for printed labels I'd make a bigger code and add the part number, so people can see what they're scanning. Here's a second Formula - Rich Text field ("QR Label") from my sandbox:
var text AddUsage = URLRoot() & "db/" & [_DBID_INVENTORY_USAGE]
& "?a=API_GenAddRecordForm&_fid_8=" & [Record ID#];
var text QR = "https://quickchart.io/qr?size=300&margin=2&ecLevel=M&text=" & URLEncode($AddUsage);
"<div style='display:inline-block;text-align:center;border:1px solid #ccc;padding:8px;width:180px'>" &
"<img src='" & $QR & "' width='160' height='160'><br>" &
"<b>" & [Part Number] & "</b><br>" & [Part Name] &
"</div>"
size=300asks quickchart.io for a sharper image, andwidth='160'shows it smaller on the page. That way it stays crisp when printed.margin=2keeps a white border around the code, which phone cameras need.ecLevel=Madds some error correction, so a scuffed label still scans.
To print a set:
- Create a table report on Inventory with just the QR Label column, or QR Label plus Part Number.
- Filter it to the parts that go in the binder and sort it the way the binder is organized.
- Print the report from your browser, or save it as PDF and print that onto label sheets.
Here's what a few printed labels look like:
Each code holds that part's own Record ID#, so print fresh labels for new parts. Existing labels keep working as long as the part record exists.
Bonus: show what's left on hand
The question mentioned depleting inventory, so here's how I closed the loop in the sandbox:
- In the Inventory / Inventory Usage relationship, add a summary field on Inventory that totals Quantity Used. I called it "Total Used".
- Add a Formula - Numeric field on Inventory called "On Hand":
[Starting Quantity] - [Total Used]
With a starting quantity of 200 hex bolts and two scans (Sarah Lee took 12 and Mike Chen took 5), Total Used showed 17 and On Hand showed 183. Every scan and save updates the count on its own.
Variations and tips
Using a=nwr instead. ?a=nwr ("new record") also opens an add form and fills in _fid_ values the same way. Either works. The wrapper is the same:
var text AddUsage = URLRoot() & "db/" & [_DBID_INVENTORY_USAGE]
& "?a=nwr&_fid_8=" & [Record ID#];
Opening a specific form with &dfid=. If Inventory Usage has several forms, or you've made a simple phone-friendly "Check Out" form, add &dfid= and the form's ID. Without it, Quickbase picks the form from your form-role settings.
var text AddUsage = URLRoot() & "db/" & [_DBID_INVENTORY_USAGE]
& "?a=API_GenAddRecordForm&dfid=10&_fid_8=" & [Record ID#];
You'll find the form ID in the list of forms in the table's settings, or in the address bar while editing the form. A short form with only Quantity Used and Checked Out By makes scanning much faster on a phone.
Filling in more than one field. Add more &_fid_X= pairs inside $AddUsage. If a value can contain spaces or symbols, such as a name or a location, wrap that value in its own URLEncode() before it goes into the URL. URLEncode($AddUsage) is still applied to the whole thing at the end. For example, & "&_fid_12=" & URLEncode([Bin Location]).
If your relationship isn't keyed on Record ID#. Some Inventory tables use Part Number as the key field. In that case the reference field holds the part number, so prefill it with URLEncode([Part Number]) instead of [Record ID#].
Keep the old QR code too. Nothing stops you from having both: one code that opens the part, and one that starts a check-out. Just label them clearly on the printout.
Summary
- Make a Formula - Rich Text field on the parent table (Inventory).
- Build an add-record URL for the child table with
URLRoot(), the child's_DBID_table alias,a=API_GenAddRecordForm(ora=nwr), and_fid_<reference field ID>=plus[Record ID#]. - Wrap that URL in
URLEncode()before putting it inside the quickchart.io link, or the part link gets cut off. - Print bigger codes with a part number for the binder. Anyone who scans needs to be signed in to Quickbase on their phone.