cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
lliu
New Member

Filtered Choice in Form does not update to SharePoint List LookUp column

Hi,

 

I want to filter a list of selections based on another column and be able to send the selection to SharePoint list.

 

I have a "Hires" List in SharePoint with a "Department" LookUp column that is referenced to a "Departments" List. The Department List has names of selection names under "Title" column with a "Status" column that is either "Active" or "Inactive". 

 

In the PowerApps application Form,  we're filling out a form that gets saved to "Hires" list. I can filter the Department dropdown (Combo Box) to display Status of "Actives":

 

Filter( Choices([@Hires].Department), Value in Filter(Departments, Status.Value = "Active").Title )

 

However, the Update property in Department Card in the Form is not saving and updating the selection to the Hire item created:

 

E.g. DataCardValue161_3.Selected

 

I tried replacing the above with the following Odata:

 

{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Id: DataCardValue161_3.Selected.Id,
Title: DataCardValue161_3.Selected.Value}

 

It still does not work and Department remains blank in the created item in Hires List.

 

While selecting the Department Combo Box, I tried changing the Data source's "Depends on..." Matching field from Hires and Id to Department and Title. This caused the field Items to a Filter from Departments but does not show anything in the dropdown.

 

Any help would be greatly appreciated.

Please don't hesitate let me know if anything needs further clarification. Thank you for your time.

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Yes, that's a perfect reason for creating your own lookup in Power Apps and not using a SharePoint lookup column type on your form. If your Department column is just a text column in SharePoint and you add a combobox in the data card in Power Apps you can set the Items property to just:

Filter(Departments, Status = "Active").Title

Your DefaultSelectedItems property just needs to lookup the value based on what is written in the connected SP column value. 

View solution in original post

5 REPLIES 5
vwyankee
Helper V
Helper V

Working with complex columns within Power Apps can often be a bit of a challenge. If it's an option, it can be much easier to have your SP columns as text columns instead and create the lookups within the Power App. Either use a reference SP list for the choices, similar to what you're doing with your SP lookup column, or hard code them as the choices in your custom combobox control. Writing the results back to the text field won't bark at you then.  

Thank you for the prompt response vwyankee!!

 

The Status column in the Deparments list plays a key role for my purpose. If I want to mark a Department from "Active" to "Inactive" from SP - the dropdown selections for Department in the PowerApps form should hide the "Inactive" ones and also wouldn't affect the existing SP items that had the Department selection.

 

I would prefer that sense of control if possible without having to edit hardcoded choices in the future.

Yes, that's a perfect reason for creating your own lookup in Power Apps and not using a SharePoint lookup column type on your form. If your Department column is just a text column in SharePoint and you add a combobox in the data card in Power Apps you can set the Items property to just:

Filter(Departments, Status = "Active").Title

Your DefaultSelectedItems property just needs to lookup the value based on what is written in the connected SP column value. 

View solution in original post

v-bofeng-msft
Community Support
Community Support

Hi @lliu :

Could you please tell me:

Does "Department" allow multiple selections?If Department allow multiple selections you could try:

DataCardValue161_3.SelectedItems

Best Regards,

Bof

Thank you! It works like a charm and serve's my need.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Power Apps Community Call Jan. 2022 768x460.png

Power Apps Community Call

Please join us on Wednesday, January 19th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (1,224)