Forum Academy Marketplace Showcase Pricing Features

[Plugin Update - Oct 9, 2019] 'Env' Environment Variables

Awesome, that was fast! Thank you :slight_smile:

1 Like

I’m planning to use this mainly for navigation (to show and hide pages dynamically for single pge apps). Currently, I’m using url params to view and hide groups(page sections) by using the workflow “go to page”. I want to use this for navigation by having “current_pageSection” or “current_pageView”. However, when I use that method, when browser’s back button is clicked or go to previous page is initiated, it will go back to previous page outside the app, not the last pageSection.

@gaurav I got an error when I am using OptionSets for the type of variables. Is that a limitation?

Screenshot 2020-05-08 00.09.09

@soh.ju.hu Yep that’s correct. Details here

Hi @shu.teopengco,
That’s how bubble works no… In my experience, you will probably need to override the browser history using js or some plugin (or maybe bubble has added a feature). That way the browser will consider it as previous page. Note that it isn’t at all related to env variables plugin.

If you’re looking for one-page app navigation system with ability to revert to previous view I recommend taking a look at Easylist element in the Utilities (bdk) plugin.

Best,
Gaurav

Thanks @gaurav, I did a work-around for now, just filter by the “Display” of All Options.

1 Like

@gaurav Can you store a list of things within the env variable? I have a list of users that I wanted to store and access through a reuseable element, but everytime I set env variable it errors saying that I can only set a single item and not a list.

Hi @messly,

Not at the moment but a wip :slight_smile:

I am using the ENV Variable on the main page of my app and set the typeas Client

The user would then add another client using a backend workflow, where a new client is created.
When this happens I want the ENV variable to be updated, which triggers a workflow. This workflow then adds a the client in the ENV variable to the Easy List plugin, from where I can do searches of clients in the Db.

My issue is that I run the set Env action in the backend workflow where the new client is created. It is a client type and a trippled checked the Variable name, but when the backend workflow runs, it does not update that particular ENV Variable. So the workflow to update the list does not run. I put a simple check in place showing the name of the ENV Variable client, but it remains empty even though the backend workflow ran.


I know for a fact the new client was created as it updates the current user’s client and shows the name when I reference that, but not if I reference the ENV Variable.

Am I missing something?

Here is a 2 min video run through of the setupp and the issue

Here you can see the Backend Workflow running when I clicked the button in the video:


Which is the one where I set the env variable in the backend workflow.

I am just wondering how I get support for this plugin if not via the forum?

Hi @christo1

Env variables are front-end only… they can’t be set in backend workflows. Backend workflows are run on bubble’s servers and plugins aren’t allowed to set data there. From backend to frontend, the only way of sending data is to use bubble’s database (i.e. save thing).

You can ‘Link’ the env variable on the page to the database field you’re saving, so that in effect you’ll be updating the env variable in the frontend whenever the field changes. In addition you can even run a workflow on the front end when this happens using the Trigger workflow on change checked .

You can reach out via chat at https://thebdk.com

Hope this helps!
Cheers,
Gaurav

That helps, I think what confused me is the fact that Set Env is an option in the backend workflow actions. Maybe this could be removed?

That’s weird… I have it set to a client-side plugin only… I can confirm this on my end too. Thanks for spotting @christo1!

@Bubble it appears this a bug with the plugin builder infrastructure. Client-side plugin action is showing up in Backend workflow. I’ve reported a bug (#11495).

Thanks :slight_smile:

Any idea when the list function will be ready? I thought it could do this and solve my preloading issue for a single page app, this would make my app 10x faster.

1 Like

Hi @kevnobrega,
Don’t have an eta yet. I’ve recently been pretty inspired by Apple’s approach to programming and I think I’ll update this plugin to use that approach. This means rebuilding it from scratch so will take a fair amount of time. Eta is unlikely in the next month, but I’ll try to prioritise this.

Hi! Great plugin! How do I send a string variable from an HTML element to the env variable?

Would love to hear more about this approach, if you’re comfortable sharing.

The idea was to pre-load important data and be able to reuse it between different things without making more calls to the server. For example, I could have an env variable load a list of Clients and then use that env variable as the data source for multiple other elements. This could also be used to load info that will be needed later in the background to make the app appear faster.

1 Like

Very interesting, @kevnobrega. I’m actually taking a similar approach. Since this plugin doesn’t currently offer support for lists, you might consider doing what I’ve done. I am using JSON Machine Pro and the Simple JSONata plugins to load and query structured data. I’m actually storing the entire UI configuration for my SPA as JSON in an Env Variable and then using the Sudsy URL routing plugin (along with the two plugins mentioned before and a lot of conditional logic) to decide what gets shown on the page at any given time.