Hi all,
I'm trying to patch a sharepoint list and I can't seem to get the toggle column to flip. If the record doesn't exist yet, it's creating it successfully and the toggle is flipped to true like I want.
If the record already exists and the toggle just needs flipped from false to true, it's not flipping.
My default value for the toggle is "checkintoggle".
I've confirmed that "myitem" is null when the entry doesn't exist yet, and is populated when it does.
Thanks in advance
My button's onselect is:
UpdateContext({checkintoggle:true});Set(myItem,LookUp('Registration Form', 'Full Name'=FullNameCell.Text && 'EventDate' >= DateAdd(Today(),-7)));
If(IsBlank(myItem),
Patch('Registration Form',Defaults('Registration Form'),{'Full Name':FullNameCell.Text,'E-Mail':EmailCell.Text,City:CityInput.Text,State: StateInput.Text,Title:VenueInput.Text, 'EventDate':EventDatePicker.SelectedDate,'Checked In?':checkintoggle,'CaptainEmail':varCaptain,'FromDomain': DomCell.Selected.Value}),
Patch('Registration Form',myItem,{'Full Name': FullNameCell.Text,'E-Mail':EmailCell.Text,City:CityInput.Text,State: StateInput.Text,Title:VenueInput.Text,EventDate:EventDatePicker.SelectedDate,'Checked In?':checkintoggle,'CaptainEmail':varCaptain,'FromDomain': DomCell.Selected.Value})
);UpdateContext({ShowDialog:true})
@RezaDorrani They're both false as expected. So I think there's something wrong with the way it's finding my baserecord. When I look at the value of "myitem" it even shows the exact record I'm expecting it to update.
Hi @russrimm
Add 2 labels (for testing purpose)
label1 text - IsBlank(myItem)
label2 text - IsEmpty(myItem)
this will help you to check the actual values of these conditions
Hi @RezaDorrani thanks, so the column name is "Checked In?". So in my Patch I tried 'Checked In?':1 and I tried Value("1"), nothing seems to patch the toggle. I even set the toggle default to an updatecontext and made the toggle visible so I could see it's behavior. When I click the button, I see the toggle flip but no go. I also tried setting the 'Checked In?' column value to CheckedToggle.Value since the toggle's object name is CheckedToggle. It seems like the true side of my If(IsBlank(myitem) is running but the false side never does for some reason?
@RezaDorrani wrote:hI @russrimm
Yes/No type columns in SharePoint need to be patched with values 0 and 1
0 - false
1 - true
Regards,
Reza Dorrani
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
hI @russrimm
Yes/No type columns in SharePoint need to be patched with values 0 and 1
0 - false
1 - true
Regards,
Reza Dorrani
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
WarrenBelz
146,594
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,928
Most Valuable Professional