How Can I Simply Decrease a Data Store Field By One?

Is there a simple way to do this?

Or is this the only way to do it?

prices_to_show.update({id: i_question_type_P.value},{number_available: prices_to_show.data.where('id', i_question_type_P.value, '==')[0].number_available - 1})

Where are you calling this from? Is it from within a repeat region created by the data store data or is it just some random button on the page, not related to this?

Good question! It is on a dmx-on:updated on a <select> element.

So is this select in a repeat region created by the data store [data]? Or is it just randomly placed on the page?

It is in a repeat, but not a repeat of this specific data store, hence it is in a random place on the page!

Then that’s the way to update it.

Thanks! :slight_smile: