Performing calculations on a database field

I am wanting to add 1 to a database record when a button is clicked.

I have the data on the screen e.g Quantity = 5 (from the database) when a button is clicked I want to update the database with 6, but I dont seem to be able (in Make Changes to Thing) to say something like Quantity = Quantity + 1

It should work exactly as you’ve stated it.

What’s the issue you’re having?

I seem to have got my self into a bit of brain freeze. The following image should be searching for a barcode in table items and updating its Quantity by +1

You don’t need to include a constraint on the search for Quantity - that’s the field you want to change.

So make sure to select ‘first item’ in the Thing to change box (after search for itemss)

Then click ‘Change another field’, select Quantity, and then input the value to change it to.

1 Like

Argh OK, so :firstitem will select the first barcode

That’s right. A search always returns a list (even if there’s only 1 item on the list), so you need to pick an item from the list using a statement such as first item, or last item, to turn the list into a single item, which is the one you’re making the changes to.

Thanks that worked, I will master this if it kills me

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.