Can't set app variable within component--not even with Formula

I found the posts and tracked bug description about how–if you’re within a component–you have to set data variables via the formula editor.

I assumed the same would be true for setting app variables, but it isn’t working for me:

Any thoughts?

App 98690

This is also true of trying to fetch an App Variable to include in a formula within a component.

I was able to find a work-around for not being able to set the App Variable, but if there’s no way to fetch the App Variable, then I don’t think my app will be able to work :frowning:

Really hoping there’s a solution for this. It would save me thousands and thousands of dollars to not have to hire a developer to build the project from scratch.

The funny thing is…I could swear had this component working before. Maybe the App Variables became unavailable when I moved everything into cards (because shadows and outlines weren’t working on containers). I can’t remember whether I’ve checked it since then.

EDIT: Confirmed. My access to variables was cut off by using the card. I moved all the content out of the cards and was able to reconnect to variables.

Still hoping that either this or the container shadows bugs can be fixed since the layout looks way nicer with shadows. But at least I’m not dead in the water!

As I mentioned in the other thread:

The idea is that you should not be able to use Set app variable within a composite component, because composite components should be separate from app logic so they are reusable. There’s a bugfix to be implemented that you shouldn’t even be able to drag the Set app/page/data variable node into a logic canvas inside Isolation Mode.

The correct way is to use Edit properties to add a new root-level property to your composite component and bind your app variable to it from the “outside”. Then, inside Isolation mode, you can use Set component property to change the root property and thus make the changes propagate to the app variable.

At the moment however, root-level properties are not accessible via the formula editor, which is a huge limitation to how much internal logic composite components can handle. This is something that will be tackled by the upcoming runtime upgrade; we’re doing our best to get it to you ASAP!

2 Likes

over a year later now…
i’m finding the same issue.

so if I took time to duplicate a card, and make a reusable component for multiple places in my app, what is the correct way to display AppVars in the card?

Hi @jaymer_jaymer, the conversation above is related to changing the values of an app variable from within a composite component. If you want to display app variables in the card, you can just bind them to the values of the card component’s configuration properties (title, content, etc.) from the outside.