Hi!
I am trying to Patch a LookUp column inside a ForAll, but I get delegation warning for this:
my_lookup: LookUp(lookupTable,Firm = dropdown.Firm)
No delegation warning:
my_lookup: LookUp(lookupTable,Firm = "Company")
The Items of the DropDown:
Sort(Filter(lookupTable,*my filter*).Firm,Firm,Ascending)
I have tried making a label with the text value of the dropdown with no help.
Since it is within a ForAll, I am not able to set a variable.
Any ideas?
Solved! Go to Solution.
A couple of things...
1) You are already looking up the records of the esc_Plants_Installators table in your combobox, so why do a Lookup again in your formula? The combobox already has the record.
2) You are referencing ThisItem in your formula...is this formula in a Form or Gallery?
3) For Patch to work properly, you only need to provide the primary key and any change information in the record supplied. If a primary key is not provided, then patch will create a record.
So given a couple of the above points, your formula should be more like this:
Patch('esc_Plants_Installator_Bemyndiget',
ForAll(Filter(InstBem_Table.AllItems, Inst_Change_1),
{
yourPrimaryKeyName: yourPrimaryKeyName,
crd27_instbemyndigetepost: TrimEnds(Inst_Epost_1.Text),
crd27_instbemyndigetstilling: TrimEnds(Inst_Stilling_1.Text),
crd27_instbemyndigettlf: TrimEnds(Inst_Tlf_1.Text),
platform_lookup: LookUp(esc_Plantss, Platform = ThisItem._platform),
installator_lookup: ComboBox3.Selected.esc_Plants_Installator
}
)
);
ForAll is not a For Loop like in some development language. It is a function that produces a table. That table can then be provided to your patch function.
What is your entire formula?
Gallery Items (InstBem_Table)
Sort(Filter(esc_Plants_Installator_Bemyndiget, platform_lookup.Platform = varSelectedAsset.Platform),'InstBemyndiget Navn',Ascending)
Combobox3 with the items I want to patch:
Sort(Filter(esc_Plants_Installators,platform_lookup.Platform = varSelectedAsset.Platform),Installator_Firma,Ascending)
Button for patching changes:
ForAll(
Filter(
InstBem_Table.AllItems, Inst_Change_1),
Patch([@'esc_Plants_Installator_Bemyndiget'],ThisRecord,
{
crd27_instbemyndigetepost: TrimEnds(Inst_Epost_1.Text),
crd27_instbemyndigetstilling: TrimEnds(Inst_Stilling_1.Text),
crd27_instbemyndigettlf: TrimEnds(Inst_Tlf_1.Text),
platform_lookup: LookUp(esc_Plantss, Platform = ThisItem._platform),
installator_lookup: LookUp(esc_Plants_Installators,esc_Plants_Installator = ComboBox3.Selected.esc_Plants_Installator)
}
)
);
= ComboBox3.Selected.esc_Plants_Installator
The bold underlined part of the patch code has the following error:
Delegation warning. The highlighted part of this formula might not work correctly with column: "ComboBox3.Selected.esc_Plants_Installator" on large data sets.
If I replace the combox with a "Text string", it works fine.
Since it is not possible to set a variable inside a ForAll, I am a bit lost on how to remove the delegation warning.
A couple of things...
1) You are already looking up the records of the esc_Plants_Installators table in your combobox, so why do a Lookup again in your formula? The combobox already has the record.
2) You are referencing ThisItem in your formula...is this formula in a Form or Gallery?
3) For Patch to work properly, you only need to provide the primary key and any change information in the record supplied. If a primary key is not provided, then patch will create a record.
So given a couple of the above points, your formula should be more like this:
Patch('esc_Plants_Installator_Bemyndiget',
ForAll(Filter(InstBem_Table.AllItems, Inst_Change_1),
{
yourPrimaryKeyName: yourPrimaryKeyName,
crd27_instbemyndigetepost: TrimEnds(Inst_Epost_1.Text),
crd27_instbemyndigetstilling: TrimEnds(Inst_Stilling_1.Text),
crd27_instbemyndigettlf: TrimEnds(Inst_Tlf_1.Text),
platform_lookup: LookUp(esc_Plantss, Platform = ThisItem._platform),
installator_lookup: ComboBox3.Selected.esc_Plants_Installator
}
)
);