There are a number of ways to do this.
1) Form rule
2) Button
and probably can use automations too, etc.
The Form Rule method is probably the most straightforward to set up (and may work better for you) - but you can decide which to use.
====
Table: Cards, with the table alias [_DBID_CARDS] (you can find the Table Alias at the bottom of Advanced Settings)
Fields:
[Quantity] - numeric field
[Number to Add] - numeric field
[New Quantity] - Formula Numeric field, with the formula: [Quantity] + [Number to Add]
Application Token:- you may need this for your Formula URL button - you can create one or use an existing one under the Application settings > App Properties > Advanced Settings > Security Options > Manage Application Token
====
Option 1: Form Rule1) Customize the form for Cards
2) Go to Dynamic Form Rules tab
3) Create a new rule
4) The rule:
When
the record is savedand
all of the following conditions are true
- Number to Add is not equal to 0
- Number to Add is not equal to (blank)
Action
-
change Quantity to the value in the field
New Quantity-
change Number to Add to the value
0So if you're editing a Card - type the number in "Number to Add", and hit Save as normal. Then the "Quantity" will be updated to the new quantity, and "Number to Add" will get reset to 0.
====
Option 2: Formula URL button1) Add a new Formula URL button, with the following formula:
- make sure to replace [_DBID_CARDS] and the application token with the values for your app
- also - make sure to update _fid_6 and _fid_7 with the correct Field ID numbers for Quantity, and Number to Add
- in this example the Field ID for Quantity is 6, which is why the URL parameter says _fid_6
// URL to the current record in view mode
var Text ViewRecordURL = URLRoot() & "db/" &
[_DBID_CARDS] & "?a=dr&rid=" & ToText([Record ID#]);
URLRoot() & "db/" &
[_DBID_CARDS] & "?a=API_EditRecord"
& "&rid=" & ToText([Record ID#]) // editing the current record you're on
& "&apptoken=" &
"REPLACE ME" // apptoken to make API calls
& "
&_fid_6=" & ToText([Quantity]+[Number to Add]) // update [Quantity] to new value
& "
&_fid_7=0" // reset [Number to Add] to 0
& "&rdr=" & URLEncode($ViewRecordURL) // redirect to the current record in View mode
This button will edit the current Card record and update the Quantity to the current Quantity + Number to Add, and reset "Number to Add" to 0, and then redirect to a view only version of the current Card.
====
Online help for API_EditRecordhttps://help.quickbase.com/api-guide/edit_record.htmlOnline help for Application Tokenshttps://help.quickbase.com/user-assistance/app_tokens.html