cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

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
Highlighted
Community Support
Community Support

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
Highlighted
Community Support
Community Support

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

Frequent Visitor

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.

 

Highlighted
Frequent Visitor

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
secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Users online (4,754)