How would you most efficiently limit the number of items that can be included in a data store?

Hi all,

I’d like to limit the number of items a user can add to a data store to say 20, and when they hit 20 trigger an alert to let them know.

I know how I’d do this on the backend with SC, and I assume that triggering a flow or using a ternary might be the solution - but I like the speed of simply inserting, so wondered what the most efficient way to achieve the above might be?

You can setup the checking logic on inserted event of data store.

1 Like

Thank you Sid. I did look at that option but perhaps not hard enough - with your guidance I’ll take another run at the insert event > logic tomorrow AM

@mgaussie, I don’t know if you have got into using Flows… but for this kind of thing they are just amazing… my app is laden with them and they make things like this soooo easy.

So I’d have a flow called “flow_insert_whatever” which starts with a condition testing the count() of the datastore and then either inserts or does whatever needs to be done if the count() is greater than 20.

In my experience, using a flow doesn’t seem to noticeably slow things down.