All Collections
Incrementing And Decrementing Values
Incrementing And Decrementing Values
Patrick avatar
Written by Patrick
Updated over a week ago

Sometimes, you want to build an app where you can increase a certain number in your data by 1 or more. Maybe to add a +1 vote, or to add +1 inventory to a certain item.

Alternatively, maybe you want to decrease the stock by 1, or maybe by 5.

Using a Google Sheet request, you can use the special Increment and Decrement Dynamic Variables:

Increment the Record ID value by 1

{{ }}

Decrement (decrease) the Record ID value by 5

{{ record.inventory.decrement.5 }}

The formula for this variable is simple, and broken into 4 parts, separated by 3 periods:
1. Data source (record, in this case)

2. Field (inventory, in this case)

3. Action (decrement or increment)

4. Amount (the amount to increase or decrease by).

When creating a Google Sheet action, you can just the variable like this:

This example would take the value of the 'inventory' column for this specific row that was clicked and increase the value by 1.

Did this answer your question?