and have it be available as dynamic data?
Any progress on this? I have just such a need myself! Actually, I need more of a āconstantā, but a global variable would work. Basically, I have a string that wonāt change but which needs to be used in various places throughout the app.
Any suggestions?
-Steve
Yeah I do this all the time. Either add such data in the data tab or build a little admin interface for it.
Hereās a simple example. Letās say you want an array of things for representing the Days of the Week.
Make a data type āDay of Weekā give it fields for Name (a text), index (a number), and anything else u want to reference about those things. Now make 7 of them.
Boom. Now you have a system level object that is a list of Day of Weeks. To access it, Do a search for Day of Weeks. This will return that list, see?
Ah yes, of course. Just use the DB.
Still, it would be great to have something like a global āstateā that could be inserted via dynamic data instead of having to do a āsearch forā and incur the overhead of DB access (although Iām sure Bubble intelligently caches things).
Thanks, @keith
What youāre describing would be the same exact thing. Iāve noted in the past that āDo a search forā¦ā / āSearch forā¦ā things is redundant terminology (it should just be labeled āThingā¦ā IMHO).
There is one alternative for system level things that you want to have available immediately in a page. You can put a custom state on the page that defaults to whatever value you want. Of course, you need to include that in any new page you build. (I guess this could be in a reusable as well.)
But thereās not really any significant performance advantage to doing that. And itās hard to maintain.
Also, if the custom state thing in question is a list (array) you wonāt be able to set a default that way.
Point is, things have to come from somewhere. That somewhere is a database.
(And yes, if this is a thing you refer to a lot, the āsearchā becomes optimized.)
This is a nice idea, and wouldnāt affect performance nearly as much as retrieving from the database.
Check out the [New Plugin] 'Env' Environment Variables plugin Itsā almost exactly what youāre asking for but at page level
Cheers,
Gaurav
Bubble Developer Kit
For anyone who might stumble upon this old thread, Option Sets pretty much addresses this for me.
I hate to revive such an old thread, but there are numerous situations where itās better to keep some part of the applicationās state in memory instead of in the primary DB. Itās dramatically faster to access and update.
In particular, if you have some process that needs to run multiple times a second or even every second, you probably donāt want to write to the DB every single time! I stumbled on this thread because Iām also looking for a clean way to create application-level state (as opposed to a custom state on a specific visual element on a single page).
@keith
If we create system level object then where does it get stored in a browser or in a bubbleās database?
Also have same question for current user record.
If we are storing data in a current user record whether it will be stored in DB or browser cookies?
@guarav,
Can we use this plugin to store a list of custom variables?
The link is not working, can you edit the link?
No, I canāt. The post is too old. Bubble has since revamped the documentation. It now resides here. Just search for āoption setsā.