cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
katunar
Level: Powered On

Remove string from variable

Hello everybody,

 

I have a gallery with checkboxes in it. When i check them, the name of the selected item will be added to a variable.

 

When i uncheck the checkbox, I want to delete the name from the variable.

 

Anybody got some advices on how to do this?

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Remove string from variable

Hi @katunar ,

Based on the needs that you mentioned, I have made a test on my side, please take a try with the following workaround:9.JPG

 

10.JPG

Within the Gallery, set the OnCheck property of the Checkbox control to following:

Set(NamesVariable, NamesVariable & ThisItem.Name)

On your side, you should type:

Set(NamesVariable, NamesVariable & ThisItem.NameColumn)

set the OnUncheck property of the Checkbox control to following:

Set(NamesVariable, Substitute(NamesVariable, ThisItem.Name, ""))

On your side, you should type:

Set(NamesVariable, Substitute(NamesVariable, ThisItem.NameColumn, ""))

Please check the following GIF screenshot:Test.gif

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
3 REPLIES 3
Highlighted
Microsoft Employee

Re: Remove string from variable

Hello @katunar 

Assuming that you have something like this to add the item name to the variable:

CheckBox1.OnCheck=Set(itemNames, itemNames&Checkbox1.Text)

You could update the "itemNames" as following:

CheckBox1.OnUnCheck=Set(itemNames, Substitute(itemNames, Checkbox1.Text, ""))

Note: I would suggest to keep all the item names in a collection rather in a simple text variable.

Community Support Team
Community Support Team

Re: Remove string from variable

Hi @katunar ,

Based on the needs that you mentioned, I have made a test on my side, please take a try with the following workaround:9.JPG

 

10.JPG

Within the Gallery, set the OnCheck property of the Checkbox control to following:

Set(NamesVariable, NamesVariable & ThisItem.Name)

On your side, you should type:

Set(NamesVariable, NamesVariable & ThisItem.NameColumn)

set the OnUncheck property of the Checkbox control to following:

Set(NamesVariable, Substitute(NamesVariable, ThisItem.Name, ""))

On your side, you should type:

Set(NamesVariable, Substitute(NamesVariable, ThisItem.NameColumn, ""))

Please check the following GIF screenshot:Test.gif

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
katunar
Level: Powered On

Re: Remove string from variable

Thank you @v-xida-msft , works perfectly.