Hi there, I'm trying to do the following thing:
I have two tables: TableX and TableX_History
Both tables look exactly the same, but we want to use TableX_History to maintain the history of TableX in SQL, example:
| ID | Revenue * | ContractType | City | Etc... | CreatedBy | CreatedDate | UpdatedBy | UpdatedDate |
| 1 | 5000 | xxx | xxx | xxx | Donald Trump | January 5th, 2016 | | |
| 2 | 900 | xxx | xxx | xxx | George Bush | June 7th, 2007 | Barack Obama | July 11th, 2020 |
So in PowerApps we have a form based on TableX (which in reality consists of 20+ columns). Now let's say that Michael Jordan wants to update the contract that George Bush signed on June 7th, 2007 and was last updated by Barack Obama on July 11th, 2021. I want TableX_History to look like this:
| ID | Revenue * | ContractType | City | Etc... | CreatedBy | CreatedDate | UpdatedBy | UpdatedDate |
| 2 | 900 | xxx | xxx | xxx | George Bush | June 7th, 2007 | Barack Obama | July 11th, 2020 |
And TableX to look like this:
| ID | Revenue * | ContractType | City | Etc... | CreatedBy | CreatedDate | UpdatedBy | UpdatedDate |
| 1 | 5000 | xxx | xxx | xxx | Donald Trump | January 5th, 2016 | | |
| 2 | 49 | xxx | xxx | xxx | George Bush | June 7th, 2007 | Michael Jordan | April 18th, 2021 |
If next year Lionel Messi updates that same contract, TableX_History should look like this:
| ID | Revenue * | ContractType | City | Etc... | CreatedBy | CreatedDate | UpdatedBy | UpdatedDate |
| 2 | 49 | xxx | xxx | xxx | George Bush | June 7th, 2007 | Michael Jordan | April 18th, 2021 |
| 2 | 900 | xxx | xxx | xxx | George Bush | June 7th, 2007 | Barack Obama | July 11th, 2020 |
And TableX like this:
| ID | Revenue * | ContractType | City | Etc... | CreatedBy | CreatedDate | UpdatedBy | UpdatedDate |
| 1 | 5000 | xxx | xxx | xxx | Donald Trump | January 5th, 2016 | | |
| 2 | 8000000 | xxx | xxx | xxx | George Bush | June 7th, 2007 | Lionel Messi | April 18th, 2021 |
If I understand correctly, I should have an UpdateIf and Patch function, but I don't know how to do a syntax that sends the previous value of a form to my History table and updates the Actual table with the news records, when a user clicks a button (Button: Save).
Could someone help me out? Thanks so much!