My form is a List on a private SharePoint Online Teams site. I edited the form using Power Apps and created 3 cascading dropdowns for the location data. I created a second SharePoint Online List that exists on the same Teams site for the dropdown Items.
The main List that I want to save the entries to is called 'Security Occurrence Report'. The second List containing the location data is called 'Locations'.
I created 3 columns that are all single line of text fields for the cascading dropdowns (LocationM, LocationZ, and LocationS). I added those fields to the form then deleted the text input and added a new dropdown. I added a data connection for the Locations SharePoint List that has 3 columns (Title - used for LocationM, Zones, and Sub-Zones) and used the following formulas to create the cascading dropdowns:
LocationM - first column
ddMajor (name of dropdown):
Items: Ungroup(Table({Value: Blank()},{Value: Distinct(Locations, Title)}),"Value")
Default: Blank()
OnChange: Reset(ddZone); Reset(ddSub);
LocationM DataCard:
Update: {Value:ddMajor.Selected.Result,ID:LookUp(Locations,Title = ddMajor.Selected.Result).ID}
Default: Blank()
LocationZ - second column
ddZone (name of second dropdown):
Items: Ungroup(Table({Value: Blank()},{Value: Distinct(Filter(Locations,Title = ddMajor.Selected.Result),Zones)}),"Value")
Default: Blank()
OnChange: Reset(ddSub);
LocationZ DataCard:
Update: {Value:ddZone.Selected.Result,ID:LookUp(Locations,Title = ddZone.Selected.Result).ID}
Default: Blank()
LocationS - third column
ddSub (name of third dropdown):
Items: Ungroup(Table({Value: Blank()},{Value: Distinct(Filter(Locations,Zones = ddZone.Selected.Result),'Sub-Zones')}),"Value")
Default: Blank()
LocationS DataCard:
Update: {Value:ddSub.Selected.Result,ID:LookUp(Locations,Title = ddSub.Selected.Result).ID}
Default: Blank()
I also created a button using the following Patch command to submit the form (I get an error trying to submit using the "save" button on the top of the form):
Patch(
'Security Occurrence Report',
Defaults('Security Occurrence Report'),
{ Title: DataCardValue14.Text, //* this is a text field renamed 'Brief Description of Events'//
LocationM: ddMajor.Selected.Result, //* first cascading dropdown//
LocationZ: ddZone.Selected.Result, //* second cascading dropdown//
LocationS: ddSub.Selected.Result, //* third cascading dropdown//
Report_x0020_Type: DataCardValue15.Selected, //* dropdown//
Reported_x0020_by: DataCardValue17.Selected, //* person lookup from company directory//
Security_x0020_Supervisor: DataCardValue18.Selected, //* person lookup from company directory//
Date_x0020__x0026__x0020_Time_x0: DateValue1.SelectedDate+ Time(Value(HourValue1.Selected.Value), Value(MinuteValue1.Selected.Value), 0), //* date and time column//
Date_x0020__x0026__x0020_Time_x00: DateValue2.SelectedDate+ Time(Value(HourValue2.Selected.Value), Value(MinuteValue2.Selected.Value), 0), //* date and time column//
Complainant: DataCardValue19.Text, //* single line text//
Person_x0020_of_x0020_Interest: DataCardValue20.Text, //* multi line text//
Description_x0020_of_x0020_Event: DataCardValue21.Text, //* multi line text//
Police_x0020_Incident_x0020__x00: DataCardValue16.Text, //* single line text//
Value_x0020_of_x0020_Damage_x002: Value(DataCardValue23.Text), //* number//
Value_x0020_of_x0020_Recovered_x: Value(DataCardValue24.Text), //* number//
OData__x0033_rd_x0020_Party_x0020_Invo: DataCardValue22.Value, //* yes/no //
Attachments: DataCardValue25 //* default attachment field//
}
);
ResetForm(SharePointForm1); RequestHide()
The form submits, closes and saves correctly but when I click an item to view it, the LocationM, LocationZ, and LocationS fields are all blank text boxes. The values appear on the email alert that is sent out and on the list view.
Not sure where to go from here, I've tried so many different types of cascading dropdowns and this is the closest I've come to getting it to work. One other problem I'm anticipating is permissions when sharing list items with people that aren't part of the private SharePoint Online Teams site, but we'll save that for another post.
Thanks for reading this far, please let me know if you need any other information or screen grabs.