Cannot find state in my reusable element

Hi.

I’m so frustrated because i’ve done this several times and it has worked. I have a reusable element in a repeating group. That reusable element has a state which i should be able to access on the page on which the element has been put.

For example, I cant create a workflow and access that state because i can’t find the element in the list
Here’s the reusable element;

and here’s the ‘Do when’ workflow which i created, but can’t access the state;

For some reason, i can’t find the element when need to use the state on my page.

How do i solve this?

Hello @tibuig welcome to the community!

Place the reusable in a popup that you never open. Call it … “barter mini menu - hidden”

You will now get to see your reusable. :wink:

Wow! thanks a lot. there must have been an update that changed that. Thanks! I’m already loving this community

1 Like

@cmarchan HOLD ON!!!

Now, when i put a text element to preview the state, I get nothing! Note that the state was set within the reusable element itself

The debugger tells me the state has been set, but apparently it has not. Actions which are supposed to trigger when that state is true are not triggered too.

Is that state attached to the outermost element of the reusable? For example if your reusable is a popup then the state must be attached to the popup itself.

You can only access states from reusable elements that way.

1 Like

Right. Your main page can only see states that are on the outermost container of your reusable. So anything you want to communicate back and forth between a reusable and its host page must be located there.

So, if there’s some internal reusable state you want to communicate to the page you would either move that state (to the outer container) or echo that state change to another state on the outer container.

Reading the docs on reusables is helpful here (though the above is basically all you need to know about page < > reusable communication.

Yes. the state is in the outermost container of the reusable element. Note that in my first problem above, I said I could not even access the state from outside the reusable, even though it was in the outermost container of the reusable element . then @cmarchan suggested that i also put the reusable element in a popup just to make it accessible, which I did, and it worked!

Now I can find the state when i need to call it, but it doesn’t show when i use the state. see screenshots above

Please can someone take a look at it? How do i send a link which is read-only?

Make your editor public (“anyone can view”).

Hi @keith @cmarchan Can you take a look at it now? There is the link to the app above. There are only 2 reusable elements so it should be easy to find the state. Try to display the state using a text on the ‘home’ group for example.

I’m not entirely sure what exactly you’re having trouble with here… I was able to do exactly that in your app (as expected)… i.e. display a text relating to a custom state value on the Barter Mini Menu Reusable element, in the Home group…

Can you be more specific as to what your actual problem is here?..

By the way, your app is publicly editable (meaning anyone can make changes to your app), so you might want to fix that asap, unless you’re happy for anyone to edit your app)

Hi @tibuig, if I understand your issue correctly, you need simply to add a new field called “Your state” at user data type in the database as a private use to configure your process.

I just might try this! Thanks

It’s a pleasure!

Ok. I’ll try to explain. You know how you create a ‘more’ menu button in a repeating group using a group focus within a reusable element, so that you can click on menu items within the group focus to take certain actions to manipulate data on a particular row in the repeating group? That’s what I’m actually trying to achieve.

The twist here is that when i click on a menu item on the group focus, it’s suppose to show a popup. I was thinking that the only way to do that is to create a state within the reusable element, so that when you click on the menu item on the group focus (which is technically within the reusable element), you can set a state to e.g ‘show’. Then you can use a ‘Do when’ workflow to display the pop up when the state is ‘Show’. The 'Do when" workflow which is supposed to trigger the pop up does not work, even when the state has been set to show.

You can’t access data (including custom states) on elements inside RGs from outside the RG, so it’s not possible to do what you’re trying to do that way (at least not without using plugins)…

Instead, you’ll need to put the Popup inside the Reusable element, then you can simply use a Show popup action when a menu item is clicked, and leave the popup’s Data Source as the RE’s thing.

Ok. this is the perfect solution. I put the element in an RE. Why didn’t I think of that. Thanks!

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.