Hi!
I finally got my Patch expression running but it is SLOOOOOW.
I know, I should swap the Patch and ForAll expressions but, after so many missteps getting to where I am, I'm a bit leery of changing stuff around.
Considering I am specifically and only patching the records of the employees on a previously combobox-selected Organization (therefore, all these employees have the same "OrgId") wouldn't if make it faster if I filter for OrgId before the ForAll or the Patch (whatever works best)?
Please check my working code below and point out how you would change it around to speed it up. Thanks!
---------------------------------------------------------
ForAll(glrEmpleados.AllItems, With(
{
_RecEmp: lblRecEmp.Text,
_OrgId: OrgId,
_Nombre: inpNombre.Text,
_Apellidos: inpApellidos.Text,
_Cargo: inpCargo.Text
},
Patch(
tblEmpleadosAB,
LookUp(tblEmpleadosAB, RecEmp = _RecEmp),
{
// RecEmp:_RecEmp, This line breaks the code and I don't know why
OrgId: Value(_OrgId),
Nombre: _Nombre,
Apellidos: _Apellidos,
Cargo: _Cargo
}
) // Closes Patch
) // Closes With
) // Closes ForAll
---------------------------------------------------------------------
Legend:
- glrEmpleados is the gallery to display and edit the data held in tblEmpleadosAB
- RecEmp is the Employee identifying field
- Nombre, Apellidos and Cargo are the column names in the Excel file named EmpleadosAB stored in Sharepoint
- inpNombre, inpApellidos and inpCargo are the Text Input controls within the Gallery to display and change data
- I get the organization from a Combobox (cbxOrganizaciones) that user clicks on.
- I show that value .cbxOrganizaciones.Selected.OrgID
Bonus track: Why does the line RecEmp: _RecEmp, break my snippet? It works Ok without it for edits but I'll try using (almost) the same code for adding records to the table.
Thanks for your help!