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

Copy field value in a column to another field in another column within an gallery

Hi

I would like to copy (transpose) a field value in a column to another field in another column within an editable gallery table. I have the following columns and field values within an gallery which is connected to an excel data table 'ATable':

 

RowIDCol1Col2
103
230

 

Onchange of the value (coloured red) I would like to change the blue coloured value to match. I have looked at doing this directly or indirectly via patch / forall to the excel data table but without much success (using Google, trying different formulas etc). [I am able to use the RowID to set the Displaymode so the 0s and 3 values are set to view mode so that the user can only edit the red value but now I need to build on this as described above].

 

Any ideas would be really appreciated

 

Thank you

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

To identify the row changed, I would use a variable, either Set or updateContext in your text input and set the rowID.   Then on patch clear it.

 

It seems that the UpdateIf might suit your needs for updating the records.  

 

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-update-updateif



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.

View solution in original post

7 REPLIES 7
Super User
Super User

Are you wanting to change it within the same record (row) or in a different row?



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.
Regular Visitor

I want to change the record in row-1, col-2 using the value in row-2 col-1 and patch both records

(i.e. change the record in row-n col-m by the record in row-m by col-n where m and n = 1,2,3.....)

Super User
Super User

You should be able to do this if you have the record ID for row 2.   How are you editing, do you have an editable field on top of the data field or are you using a form?

 

 



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.
Regular Visitor

Yes, I have a record ID see the 'RowID'. Yes it is an editable table 'ATable' in a gallery. This is what I have: in TextInput for Col1 OnChange:

Patch(ATable,LookUp(ATable,Value(RowID)=1),{Col2:TextInput_Col1.Text})) but I am struggling with how to update both records and to include a switch statement to identify the row changed.

 

Super User
Super User

To identify the row changed, I would use a variable, either Set or updateContext in your text input and set the rowID.   Then on patch clear it.

 

It seems that the UpdateIf might suit your needs for updating the records.  

 

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-update-updateif



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.

View solution in original post

Thank you that helped. Is this what you were thinking:

 

UpdateIf(ATable,Value(RowID)=1,{Col2:TextInput_Col1.Text},Value(RowID)=2,{Col1:TextInput_Col1.Text})

 

Seems slow.

Super User
Super User

Yes.  That's what I was thinking.    Does it work though?   You may have to use variable values if the rows you are updating are not static, say if you want to update row 1, col2 with the value from row 3.

 

 



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Top Solution Authors
Top Kudoed Authors
Users online (32,675)