Hi everyone,
I've a table of 6k data and I would to use UpdateIf, but doesn't work over the 2k.
Can you help me?
This is an example of my code:
UpdateIf(
Table;
And(
FirstName = "John";
Value(Year) < 35
);
{ Access: "YES" }
)
This works:
With(
{_Reccount:CountIf(DierEvent,xDocaNummer>0)}
,ForAll(
Sequence(RoundUp(_Reccount/2000,0),1)
,With(
{
source: Filter(DierEvent,xDocaNummer>0)
}
,ForAll(
source
,With(
{
_TxtDocaNum:Text(xDocaNummer,"00000")
,_rec:ThisRecord
}
,Patch(
DierEvent
,_rec
,{
Animal:LookUp([@Animals] As AN,AN.'Animal Number'=_TxtDocaNum)
,xDocaNummer:0
}
))
)
)
)
)
Alas, no cigar
Only 2000 are processed while
With(
{
source: Filter(DierEvent,xDocaNummer>0)
}
,ForAll(
source
,With(
{
_TxtDocaNum:Text(xDocaNummer,"00000")
,_rec:ThisRecord
}
,Patch(
DierEvent
,_rec
,{
Animal:LookUp([@Animals] As AN,AN.'Animal Number'=_TxtDocaNum)
,xDocaNummer:0
}
))
)
)
Thank you so much @LaurensM,
It doesn't work with a large table,
but I've create a empty hidden gallery with a first filter and i've changed the code:
HiddenGallery.Items:
Filter(
Table;
'FirstName = "John"
)
Button.OnSelect:
With(
{
source: Filter(
HidenGallery.AllItems;
And(
Value(Year) < 35
)
)
};
ForAll(
source;
Patch(
Table;
ThisRecord;
{ Access: "YES" }
)
)
)
Now it works perfectly!!
Hi @DavidePF90,
UpdateIf() is indeed not delegable, meaning it will only look at the first 500 to 2000 records. However if you are using Dataverse as a data source, this may change in the near future (see wave 1 2023 release plan).
A current possible workaround is by using a ForAll() on a filtered data set. In your case this would be:
With(
{
source: Filter(
Table;
FirstName = "John" && Value(Year) < 35
)
};
ForAll(
source;
Patch(
Table;
ThisRecord;
{Access: "YES"}
)
)
)
If this solves your question, would you be so kind as to accept it as a solution.
Thanks!
WarrenBelz
146,658
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,999
Most Valuable Professional