Variables not being passed

Variables not being passed

  

Hi,

So I have this screen:

The user is supposed to select a value from the combobox, write something in the textbox, and when he presses the button I create a new "Suggestion" entity with those values and some more. Problem is these two values aren't being passed. I tried doing it with a local "Suggestion" var, with local vars, with session vars, and nothing seems to work. They both have the warning that they aren´t bound to the ListRecords, but they´re not suppose to be. This is all inside a WebBlock, don't know if it's relevant for anything.

Thanks in advance.

Hi Rui,

The List Records Widget is used for displaying data. You have data input, so you should use the Edit Records Widget or the Form Widget instead. The only drawback is that you'll need to have a Structure that contains all the input values. Alternatively, don't use a Widget at all, and just put the Input Widgets on the Screen, and bind them to a Local Variable (as opposed to binding a Local Variable of type Structure to the Form Widget).

When you press the Button, the Screen Action that is triggered has access to all Screen Variables and Widgets, including those bound to the Input Widgets.

I managed to successfully create a new Structure entity with the correct values with the Edit Records Widget, but I have a new problem. I need to have one Edit Records for each user that I find in an Aggregate, but outsystems doesn't let me have an Edit Records Widget inside a List Records Widget (it actually crashes it for some reason).

I also can't have a List Records inside another List records, so I'm not able to do it in the Web Screen. 

Solution

Hi Rui,

You should encapsulate the Edit Records for a single user in a Web Block, and use the Web Block in a List Records.

Solution

I tried to do that in the Web Screen, but it won't let me cause I have another List Records before that.

One List records to iterate through Groups.
One List records to iterate through the Users in each Group.
One Edit Records for each User inside the Web Block.

I can't have both in the Web Screen, but I also can't have one inside the Web Block cause of the Edit Records.

I guess I can have this structure:

Web Screen with List Records to iterate Groups
Web Block with 2nd List Records to iterate Users.
Web Block with Edit Records for each User.

Gonna try it out

Yes, you can nest two Web Blocks, that's no problem. However, why do you need to list the Groups, with the users inside? For styling?

Yes exactly that. I have a Section for each Group since these can have a pretty large number of Users.

I managed to do that by doing the List Records - Web Block - Web Block structure, only problem I have now, is the CreateStructure action is being run twice when I click the Button to run the action. Still trying to figure out why.

Edit: Problem solved. For some reason having an "End" at the end of the Create action (inside the last Web Block) made so the whole Create action would run again. I don't know why, but it got fixed replacing the "End" with a navigate to another screen.