New to Outsystems, encountered a Checkbox issue

When I select a check box, click the save button and click the left arrow on my browser to return, the same page will not have an issue but all my check boxes in the next page of the selection become selected which is not what I want.


Before and after saving


After saving then navigating to the next selection page


Save button

Hello Yao, 

Your checkbox is bounded to which variable? If they appear checked ia because the variable is set to true. 

It looks like you created one single local variable and that you assigned every boolean of every row to that same local variable. So if this is set to true, it is not visible yet (because the page needs to be refreshed).

Niek de Jong wrote:

It looks like you created one single local variable and that you assigned every boolean of every row to that same local variable. So if this is set to true, it is not visible yet (because the page needs to be refreshed).


Is there a way to assign the rows with different local variables? It seems that I can only use 1 or I might be mistaken

Eduardo Jauch wrote:

Hello Yao, 

Your checkbox is bounded to which variable? If they appear checked ia because the variable is set to true. 

My table don't have any boolean variable so I created a local variable to bind because I want to show that my stuff are being selected


Hi,


Yes, as you only associated the same local variable it is normal in the next screen, that all options appear selected. To solve this or you create multiple variables one for each option.

But if you can only select one option, why not use the radio button?


Hope it helps :)

Yao Teck Ong wrote:

Niek de Jong wrote:

It looks like you created one single local variable and that you assigned every boolean of every row to that same local variable. So if this is set to true, it is not visible yet (because the page needs to be refreshed).


Is there a way to assign the rows with different local variables? It seems that I can only use 1 or I might be mistaken

If your picklist comes from an aggregate, in the aggregate you can create a new boolean column with only false values. This way you can associate a boolean to each option.

Hi,

You should have a boolean attribute on your aggregate to match the checkbox value.You can use the "Boolean" structure available on RichWidgets and add it as source to your Aggregate.


Then bind this aggregate attribute to your checkbox.

Regards,

Daniel

Solution

Hi, 

As suggested, if you want to make a single selection, the ideal is the Radio Button. 

To use it, you create a variable of type <YourEntity> Identifier, as what you want is to know which line (record) is selected. 

In the table records in the screen, instead of a check bix, place a radio button. 

Bind the radio button (Variable Property) to your local variable. 

As Value you set <YourTableRecords>.List.Current.<YourEntity>.Id

This way, when the user set one radio button and later you submit to a screen action, the variable will hold the line ID and you can use this information. 

If you want to enable more than one selection, create a valculated field in the aggregate, give it a name like IsSelected and as formulae set False. 

When submitting to a screen action, you can iterate the <YourTableRecord>.List using a ForEach and check each record to see which ones have the <YourTableRecord>.List.Current.IsSelected set to True and execute your task over those items. 

Hope this helps. 

Cheers 

Solution

Eduardo Jauch wrote:

Hi, 

As suggested, if you want to make a single selection, the ideal is the Radio Button. 

To use it, you create a variable of type <YourEntity> Identifier, as what you want is to know which line (record) is selected. 

In the table records in the screen, instead of a check bix, place a radio button. 

Bind the radio button (Variable Property) to your local variable. 

As Value you set <YourTableRecords>.List.Current.<YourEntity>.Id

This way, when the user set one radio button and later you submit to a screen action, the variable will hold the line ID and you can use this information. 

If you want to enable more than one selection, create a valculated field in the aggregate, give it a name like IsSelected and as formulae set False. 

When submitting to a screen action, you can iterate the <YourTableRecord>.List using a ForEach and check each record to see which ones have the <YourTableRecord>.List.Current.IsSelected set to True and execute your task over those items. 

Hope this helps. 

Cheers 


I managed to solve the error but a new one pops up, every time I tick and navigate to the next page of the selection of the asset page (page 2 for example), the checkbox that I ticked will be unselected.


This is my new flowchart


My save button flowchart

Hi, 

If you are not saving your state in database (and retrieving it on next page), or saving in session variable, and instead is using local variables, when navigating for other page (or the current one) you will lost the actual state, as when navigating the local variables at destination are reset. 

Screen variables and widget variables, like the list of a table records or the record of a form are local variables. 

Cheers

Eduardo Jauch wrote:

Hi, 

If you are not saving your state in database (and retrieving it on next page), or saving in session variable, and instead is using local variables, when navigating for other page (or the current one) you will lost the actual state, as when navigating the local variables at destination are reset. 

Screen variables and widget variables, like the list of a table records or the record of a form are local variables. 

Cheers


ok that makes sense, thank you