I'm having a problem with my patch function. There is an if statement that determines whether or not the patch function creates a new row or updates an existing row in my table. Creating a new row works, but for some reason when updating an existing row the row below the one selected in my gallery control is being modified rather than the row that was selected in the gallery. Here is the code I am using to patch the table:
UpdateContext({tempsave:1}) ; If(NewGate = 2, Patch('datasource', {cpcId:Gallery1.Selected.cpcId}, SummaryFormLCG1.Updates, PlanningFormLCG1.Updates, FinancialsFormLCG1.Updates), Patch('datasource', Defaults('datasource'), SummaryFormLCG1.Updates, PlanningFormLCG1.Updates, FinancialsFormLCG1.Updates))