Hello Everybody,
I am updating a SharePoint list using the code below and this works.
Patch(RCAData, LookUp(RCAData, BatchID = DataCardValue16_2.Text && WaferID = DataCardValue28_2.Text),
The issue I have is it's possible to have duplicate entries in my list and this is a feature I want.
When I try to update the second entry then it updates the first entry instead, as I haven't specified which one to select. The update will always be for the last entry, so I want to do by date order. Can anyone advise the code for this and still keep the lookUp code for BatchID and WaferID.
Thank you in advance.
Rob
Sorry it should be Filter rather LookUp
UpdateContext({lclItemToPatch:
First(
SortByColumns(
Filter(RCADate, BatchId = DataCardValue16_2.Text && WaferId = DataCardValue28_2.Text),
"Created",
SortOrder.Descending
)
)
})
-------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Hello again,
I get the errors in the screen shot below
Not too sure it sees my BatchID and WaferID as a table.
Thanks
Rob
Could you try this to populate the variable, I've used SortByColumns rather than Sort. You can then try the patch function as per the previous reply. You will need to populate information into the {} section for the data you need.
Created should be a column in a SharePoint list.
UpdateContext({lclItemToPatch:
First(
SortByColumns(
Lookup(RCADate, BatchId = DataCardValue16_2.Text && WaferId = DataCardValue28_2.Text),
"Created",
SortOrder.Descending
)
)
})
Thank you but the code uses a column for the sort function and this won't compile. I don't know why, I tried different columns.
Hi,
Instead of having a lookup inside the patch, you could set a variable as the lookup and reference that.
UpdateContext({lclItemToPatch:
First(
Sort(
Lookup(RCADate, BatchId = DataCardValue16_2.Text && WaferId = DataCardValue28_2.Text),
Created,
Descending
)
)
});
Patch(RCData, lclItemToPatch, {})
I always get Ascending and Descending the wrong way round, but something like this
Hello,
You can try and sort the lookup formula in a descending order
Which of the ID is the unique ID for your Data source ?