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.
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).
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
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).
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?
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”.