How to limit workflow runs per month in Bubble with ChatGPT or OpenAI | Planetnocode.com

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
foreign I demonstrated how to create a button which keeps track of how many times the workflow is run so each time the user clicks it goes up we've got a count on current user and it will limit the user to clicking it five times but that's rather permanent for most SAS apps uh you're you'll want to be limiting an action maybe to every month so how do we go about doing that well let me show you I would start by creating on the user a new field and we'll call this um button clicked date remember I'm just using a very simple example of this button being clicked but you can use this with any workflow to track the number of times and to limit how many times that is run and I'm going to make this into a list and this is going to allow us to collect dates and time stamps of when the buttons clicked so instead of us doing a simple count I'm going to say that this is button clicked dates add current time and date so let me run this and show you what difference it makes um in fact I'll delete that for now and let's update clear to clear not our account from a different tutorial but buttons clicked uh clear list cool so if I click the button the workflow runs and I'll click the button again so that we get a list and now if I go into Data I'm running as this user here and you can see that I've now got a list of of the dates um and I'm not sure is it easy for me to edit these uh no but I can add new ones okay I'm just wanting to be able to give you a full demonstration um but what I could do I will demonstrate this without having to manipulate data from the database is say that this button can only be clicked five times in one month so let me clear out my simple count and this time I'm going to go for a current user uh buttons clicks clicked dates and I can't do a group by that was my initial uh way of doing it because I'm not actually doing a do a search for this is a list in a field um so in fact I'll go for a filter uh and I'll say when uh this date so that's referring to each date in the list uh is uh greater than current time date uh ah okay I need to do it the opposite way around so unless you have the uh parentheses experimental feature enabled um when you do a comparison between dates you can front load the first date with uh additional manipulations but you can't to the second date so actually we need to approach this the opposite way around so rather than starting with this date we start with uh current timer date how to get this right current time of date is uh so I'm wanting to count how many are how many date stamps date timestamps have occurred in this month so I will say current time and date is uh less than uh okay had to pause for a moment that's trying to work out no I need to do current time to round it down to month is um so that gives me Midnight at the very start of the month and so I could actually get away with saying um is less than uh this date and then I think I need to account for the other side of this oh my brain is not doesn't seem to be working well on this uh I'm sure you've probably got their rights away with the how to um get what I'm trying to do which is just to only set dates in the current month um right I got it I've been approaching it the wrong way so you probably could sandwich the dates but actually you can do it much more easily with a current date time extract month so this gives you a numerical value for the month is uh this dates extract mark so that's going to return only the dates in the current month and then I can do account and I can say is uh less than five and again I'll make it unclickable and I've got a I'm just going to remove the condition based on my previous video of doing a count so when the button is clicked uh I add a date and I should only be able to click on the button until the number of days in this month is all the way up to five Let's test that out and in fact I will put a text box back in say current user list of dates so we can see them uh okay what have I got going on here so it is already unclickable uh uh and I've got two dates in there so have I got my condition wrong uh isn't clickable oh yeah right yes because it's it's almost like a double negative it's when it isn't clickable and I don't want it to be clickable when the number of dates is greater than five so I've got that the wrong way around there we go nine click click click click one two three four five that should be equal to greater than 5. let's try that again one two three four five and there we go it's now unclickable so as I pointed out in the previous video you might also want to consider copying this expression and adding it to your workflow simply because making a battle unclickable um it with the the right amount of knowledge of using the browser inspect inspectors uh that a user might be able to find a way of making a button clickable when you've said it shouldn't be clickable um and so if you really want to protect the amount net uh say an external API is being called you want to add that condition to the workflow as well as to your button so to thoroughly test it and ensure that um I've got this exactly right I'm going to add in some other dates in here from different months so we'll go for March uh 20 23 and we'll go for February just posting out around them ones and then uh let me delete all the ones from April so all of these four ones because that's the current month so we can now see that the button is clickable and uh to really check that I've got this right I'm going to take this down to two so I have two entries into this field one from March and one from February but the button is still now clickable and it should allow me made this exact mistake in the previous video this needs to be the opposite way around uh so only clickable when it is uh less than five that's when I want the action to take place and that's why it wasn't working okay let's try that again it's hopefully one last time uh right it adds in April adds in another April because there are two aprils the button is now unclickable um and so the workflow is not going to run let's go back into the database triple quadruple check I've got this right let's remove uh a April entry it's now clickable again and I can add back in an April entry and it is now unclickable so there you have it um uh I've got that earlier video which shows you simply how to limit a user's actions using accounts um but that is rather fixed uh as I said in this video for most SAS apps that you might be building a bubble you're probably looking at a monthly credit system and this is one way of approaching that uh by keeping track of the number of dates that are in a particular field for the current month thank you
Info
Channel: PlanetNoCode
Views: 383
Rating: undefined out of 5
Keywords: bubble, tutorial, saas, bubbletutorial, nocode, startup, entrepreneur, webapp
Id: _6z9FFkt_lE
Channel Id: undefined
Length: 9min 21sec (561 seconds)
Published: Tue Apr 18 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.