Hello everyone,
I'm facing an issue while trying to use the Patch function in a gallery populated with data from a SharePoint list.
Scenario:
I have a gallery (Gallery2) that displays data from a SharePoint list. The gallery shows the fields Trilho and Num_Cabine, as shown in Image 1 (attached).
I created a collection (MinhaColecaoComValores) from this gallery using the code below:
Clear(MinhaColecaoComValores);
ForAll(
Gallery2.AllItems,
Collect(MinhaColecaoComValores,
{
ID: ThisRecord.ID,
Trilho: ThisRecord.Trilho,
Num_Cabine: ThisRecord.Num_Cabine,
ValorAnterior: If(
CountRows(MinhaColecaoComValores) = 0,
Blank(),
Last(MinhaColecaoComValores).Num_Cabine
)
}
)
)
The idea here is to collect the Num_Cabine value from the previous row so that it can be used later.
After collecting the data in the collection, I want to use the previous value (ValorAnterior) to update the gallery, where the previous Num_Cabine value is moved to the next row.
I'm trying to do this using the code below:
ForAll(
MinhaColecaoComValores,
Patch(
'Trilho de Cabines Base de Dados',
LookUp(
'Trilho de Cabines Base de Dados',
ID = ThisRecord.ID
),
{Num_Cabine: ThisRecord.ValorAnterior}
)
)
Problem:
When I run the Patch code, I'm getting the following error:
Error when trying to retrieve data from the network: Fetching items failed. Possible invalid string in filter query.
However, when I replace ThisRecord.ID with a specific number in the ID field in the LookUp, the Patch works normally.
Question:
Could someone help me identify what might be causing this error? Is there any adjustment I need to make in the LookUp or Patch query to avoid this problem?
Thanks in advance for your help!
Patch(
'Trilho de Cabines Base de Dados',
ForAll(
MinhaColecaoComValores As _table,
{
ID : _table.ID
Num_Cabine: _table.ValorAnterior
}
)
)
Patch(
'Trilho de Cabines Base de Dados',
ForAll(
MinhaColecaoComValores As _Data,
{
ID: _Data.ID
Num_Cabine: _Data.ValorAnterior
}
)
)
WarrenBelz
146,596
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,928
Most Valuable Professional