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

Within a Gallery, Set the value of a Textbox/Checkbox "OnChange" of another Textbox

Layout:

Screen

    Gallery

         Textbox1 or Checkbox1

         Textbox2

 

Within this Gallery, OnChange of "Textbox2", I would like to update the value in "Textbox1 or Checkbox1". How do I get this accomplished? 

 

Functionality: I have a Gallery, which contains multiple rows (and multiple controls in each row). I would like to update only rows that are changed and I am trying to set a "Dirty" flag in each row, based on the event "OnChange" of a textbox.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Within a Gallery, Set the value of a Textbox/Checkbox "OnChange" of another Textbox

Hi @gopinathdee ,

Do you want to update a a value in TextInput box or a Checkbox based on the "OnChange" of another TextInput box?

 

Based on the needs that you mentioned, I think the OnChange property of the TextInput box could achieve your needs. I have made a test on my side, please take a try with the following workaround:

The data structure of my table as below:9.JPG

App's configuration as below:11.JPG

 

10.JPG

On my side, I add a Gallery control within my app, set the Items property to my data table -- RecordsTable.

I assume that you want to check the Checkbox when the Amount value has been changed within the TextInput2 box, please take a try with the following workaround:

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

If(Value(TextInput2.Text) <> ThisItem.Amount, true, false)

Please check the following GIF screenshot for more details:Test.gif

 

After that, you could find these rows you need to update based on whether or not the Checkbox is checked. If you want to bulk update these changed rows within your Gallery, I think the Filter function, ForAll function and Patch function could achieve your needs, please take a try with the following formula:

ForAll(
         RenameColumns(Filter(Gallery1.AllItems, Checkbox1.Value = true), "PrimaryColumn", "PrimaryColumn1"),
         Patch(
                   'YourDataSource',
                   LookUp('YourDataSource', PrimaryColumn = PrimaryColumn1),
                   {
                      Amount: Value(TextInput2.Text)
                   }
         )
)

Note: The PrimaryColumn represents the column in your data source, which could identify one record uniquely. The Amount represents the column in your data source, which you want to update based on the TextInput2 box value.

 

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.

View solution in original post

3 REPLIES 3
Community Support Team
Community Support Team

Re: Within a Gallery, Set the value of a Textbox/Checkbox "OnChange" of another Textbox

Hi @gopinathdee ,

Do you want to update a a value in TextInput box or a Checkbox based on the "OnChange" of another TextInput box?

 

Based on the needs that you mentioned, I think the OnChange property of the TextInput box could achieve your needs. I have made a test on my side, please take a try with the following workaround:

The data structure of my table as below:9.JPG

App's configuration as below:11.JPG

 

10.JPG

On my side, I add a Gallery control within my app, set the Items property to my data table -- RecordsTable.

I assume that you want to check the Checkbox when the Amount value has been changed within the TextInput2 box, please take a try with the following workaround:

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

If(Value(TextInput2.Text) <> ThisItem.Amount, true, false)

Please check the following GIF screenshot for more details:Test.gif

 

After that, you could find these rows you need to update based on whether or not the Checkbox is checked. If you want to bulk update these changed rows within your Gallery, I think the Filter function, ForAll function and Patch function could achieve your needs, please take a try with the following formula:

ForAll(
         RenameColumns(Filter(Gallery1.AllItems, Checkbox1.Value = true), "PrimaryColumn", "PrimaryColumn1"),
         Patch(
                   'YourDataSource',
                   LookUp('YourDataSource', PrimaryColumn = PrimaryColumn1),
                   {
                      Amount: Value(TextInput2.Text)
                   }
         )
)

Note: The PrimaryColumn represents the column in your data source, which could identify one record uniquely. The Amount represents the column in your data source, which you want to update based on the TextInput2 box value.

 

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.

View solution in original post

Highlighted
gopinathdee
Level: Powered On

Re: Within a Gallery, Set the value of a Textbox/Checkbox "OnChange" of another Textbox

@v-xida-msft - Thanks for taking the time in coming up with this detailed message. I totally appreciate that.

The solution you provided works as expected. 

 

I was trying to, change the value of the Checkbox OnChange of the Textbox and that did not work.

Your approached this from a different perspective and it totally worked.

 

Thanks again.

 

gopinathdee
Level: Powered On

Re: Within a Gallery, Set the value of a Textbox/Checkbox "OnChange" of another Textbox

Also, I think you meant, the OnChange property of the Textinput box could not achieve your needs. Is it?

 


Based on the needs that you mentioned, I think the OnChange property of the TextInput box could achieve your needs.

Helpful resources

Announcements
Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Microsoft Business Applications Virtual Launch

Join us for the Microsoft Business Applications Virtual Launch Event on Thursday, April 2, 2020, at 8:00 AM PST.

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (6,769)