I am using the Switch function to utilise different SharePoint Lists when viewing a gallery,
I am trying to write to the selected SharePoint List using a Patch function,
I am using the following but generates an error.
Patch(Switch(
Dropdown6.Selected.Value,
"Cov", Cov_SP,
"Wor", Wor_SP),
ThisItem,
{
'Shift Date': DataCardValue5_1.SelectedDate,
'Shift Time': DataCardValue7_1.Text,
'Skill Set': DataCardValue14_1.Selected,
Location2: Dropdown2.Selected
}
)
Can anyone see where i'm going wrong please.
Thanks for the response, looking back at the original post a crystal ball would have definitely helped.
My scenario is the following, I have 2 SharePoint Lists called Cov_SP & Wor_SP these hold the complete data for 2 locations. I have a dropdown box which allows the user to select either location.
The location is connected to a Gallery and the results from the drop down populate the gallery. Both lists have identical columns.
What i am trying to do is allow the user to fill in a form that populates new information into the selected SharePoint list. I have used the SubmitForm command which works but i have specific information that needs to be patched that's pulled from a variable.
I may be going about the code wrong that was my attempt at trying, badly.
Does this make any sense.
Hi @Markswan20
What error I don't see it? I'd love to guess it, but my wife stole my crystal ball and all knowing mirror 🙂
1. What exactly are you trying to do with this switch statement as you also don't explain that so honestly I have no clue.
Let's reformat your code to see what it's doing better. So looking at it, what exactly is Cov_SP value going to? I don't see a Column Identified.
So what this code, looks like it does
1. says Cov_SP is the record you want to change, but even if true, you provided no values
2. says Wor_SP is the record you want to change, but even if true, you provided no values
3. Your fault says, ThisItem (are you in some gallery I don't see????) and logistically would try to patch ThisItem, but I have no idea if ThisItem is a Record or Table or a Value.
Can you please explain what you were attempting please.
Patch(
Switch(Dropdown6.Selected.Value,
"Cov",
Cov_SP,
"Wor",
Wor_SP),
ThisItem,
{
'Shift Date': DataCardValue5_1.SelectedDate,
'Shift Time': DataCardValue7_1.Text,
'Skill Set': DataCardValue14_1.Selected,
Location2: Dropdown2.Selected
}
)
If I have helped you, I would really appreciate if you please Mark my answer as Resolved/Answered, and give it a thumbs up, so it can help others
Cheers
Thank You
Michael Gernaey MCT | MCSE | MCP | Self-Contractor| Ex-Microsoft
https://gernaeysoftware.com
LinkedIn: https://www.linkedin.com/in/michaelgernaey