Images often live on child records—for example, photos attached to many Files records under one Project. Instead of opening each record, one button on the parent record can process the images on all of its related records. This is called multiple-record mode.
A button or API request can process up to 50 records at a time. For more, or to run automatically, use batch processing, which uses the same parameters.
If the query matches more than 50 records, nothing is processed and the result reads Error - Proccessing more than 50 records - recommend using batch process.
Records whose image field is empty are skipped without an error.
How it works
The button passes:
query—a Quickbase query that selects the records to process.
querydbid—the table to query. If omitted, the button's own table is used.
recid—the Record ID# of the record with the button (the parent). The images come from the query, not from this record, but keep recid in the formula: it's required whenever you use triggerfid, because that's the record the status is written to. The examples below always include it.
The FIDs in clist, and in any tracking lists such as falist or updatefidlist, refer to fields on the queried table. The resize values (width, height, rsrate, and so on) come from the record with the button and apply to every image.
Example
In this app, each Project has many Submittals, and each Submittal has many Files. Each Files record has two photo fields (FIDs 6 and 15). The goal is to resize every photo for a project to 100 × 100 pixels from a button on the Project.
Make the project available on Files. Add a lookup of the related project's Record ID# to the Files table, through the Submittals–Files relationship (in this example, FID 39, Related Project).
Create the input fields on Projects—for example, New Width and New Height.
Create the button on Projects, a Formula - Text field with Allow some HTML tags selected:
var text url = "https://.../ImageResizer.aspx?" // your Image Resizer/Rotator server URL
& "clientid=Q#" // your Client ID
& "&appid=" & AppID()
& "&dbid=" & Dbid()
& "&recid=" & [Record ID#] // this project (the record with the button)
& "&query={'39'.EX.'" & [Record ID#] & "'}" // Files records for this project
& "&querydbid=" & [_DBID_FILES] // the Files table
& "&clist=6.15" // photo fields on Files
& "&width=" & [New Width]
& "&height=" & [New Height];
"<a class='Vibrant Success OpenAsPopup POSTTempToken' data-height=400 data-width=800 data-refresh=true data-temptokendbid='" & Dbid() & "' href=\"" & $url & "\">Resize Project Photos</a>"In the query, '39' is the Related Project field on Files, EX means "is equal to", and the value is this project's Record ID#. [_DBID_FILES] is the Files table's alias, found in that table's settings under Advanced.
Keep data-temptokendbid set to the button's own table (Dbid()), not the queried table.
Rotate across multiple records
Use the RotateImage.aspx address. You can rotate in either of two ways:
The same amount for every image—pass rotateval. Create a Text - Multiple Choice field on the parent—for example, Rotate Value—with the choices 0, 90, 180, and 270. A number followed by degrees (90 degrees) also works, but text such as Do not rotate or a blank value is an error.
An amount per image—add rotation fields to the queried table and pair them in clist (for example, clist=6:40.15:41). Each image is rotated by the value on its own record. See Rotate images.
Example using rotateval:
var text url = "https://.../RotateImage.aspx?" // your Image Resizer/Rotator server URL
& "clientid=Q#"
& "&appid=" & AppID()
& "&dbid=" & Dbid()
& "&recid=" & [Record ID#]
& "&query={'39'.EX.'" & [Record ID#] & "'}"
& "&querydbid=" & [_DBID_FILES]
& "&clist=6.15"
& "&rotateval=" & [Rotate Value];
"<a class='Vibrant Success OpenAsPopup POSTTempToken' data-height=400 data-width=800 data-refresh=true data-temptokendbid='" & Dbid() & "' href=\"" & $url & "\">Rotate Project Photos</a>"For every parameter, see Formula URL parameters.