Hi @Aleksey24 ,
Firstly @Tolu_Victor is correct in the update logic, but your code should actually work if the ID of the record (I assume this is a SharePoint list) is in the Collection. I think your issue lies here (note the ID value in the top Patch)
If(
ThisItem.ID in colltaskupdate.ID,
Patch(
colltaskupdate,
{
ID: Value(Textlnputl.Text),
GROUP: Textlnput2.Text,
DESCRIPTION: Textlnput3.Text,
FIX: Textlnput4.Text,
HIGH: TextInput5.Text,
WIDE: TextInput6.Text,
LENGTH: TextInput7.Text
}
),
Collect(
colltaskupdate,
{
ID: Value(Textlnputl.Text),
GROUP: Textlnput2.Text,
DESCRIPTION: Textlnput3.Text,
FIX: Textlnput4.Text,
HIGH: Textlnput5.Text,
WIDE: TextInput6.Text,
LENGTH: Textlnput7.Text
}
)
)
If this still does not work, the alternative is to head down the second Patch road as @Tolu_Victor described, I will offer some fundamental advice here that may assist with this and future ForAll() exercises. It is not designed to be a Loop, although it can work this way with considerable performance penalty as it does an individual Patch for each record. ForAll() creates a Table, which can be patched in one action provided its content is correct. For new records, this is simply a Table with field names and field types matching the list. For existing records, including the SharePoint record ID in the table causes it to update that record for each of the Table records. Therefore you would do something like this
Patch(
ExcelTable,
ForAll(
colltaskupdate As aPatch,
With(
{
wID:
Lookup(
colltaskupdate,
ID = aPatch.ID
).ID
},
{
ID:
If(
!IsBlank(wID),
wID
),
GROUP: aPatch.GROUP,
DESCRIPTION: aPatch.DESCRIPTION,
FIX: aPatch.FIX,
HIGH: aPatch.HIGH,
WIDE: aPatch.WIDE,
LENGTH: aPatch.LENGTH
}
)
)
)
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Visit my blog Practical Power Apps