Reputation: 83
I'm creating a form in PowerApps canvas to allow project managers to add/edit data in a Microsoft Lists table. The table contains a list of distinct projects, each with 1 project manager and other information, as shown in the screenshot:
The form should allow project managers to select their name from a dropdown list (A: 'Project Lead'). Based on this selection, the form should populate a second dropdown (B: 'Project Name') showing only the project names associated with that project manager.
I can get the Items for (A) to populate correctly with Choices([@'Project database'].'Project Lead')
, but I cannot get the formula for dropdown (B) to filter project names based on the selected project manager (which is a Person field with associated DisplayName, Email, ... information).
Here is my current formula to populate the Items of dropdown (B):
Filter([@'Project database'].'Project name', [@'Project database'].'Project Lead'.DisplayName = DataCardValue1.Selected.DisplayName)
The error description says that " 'DisplayName' is not recognized as a valid property and there is an incompatible type for comparison between Error and Text."
I believe .DisplayName
is found correctly for the DataCardValue1 part, but not for the 'Project Lead' column. I have also experimented with .Value
instead of .DisplayName
, but no luck.
What am I doing wrong?
Upvotes: 0
Views: 142
Reputation: 1109
You need to update your formula in Item property of Project Name dropdown as below:
Filter('Project Database',
'Project Lead'.Email = DataCardValue1.Selected.Email
)
The reason why you code was generating error was because in the first parameter of your Filter
query you were pass the single column as a list to search through (i.e. Project Name) and in the second parameter you were comparing it against your 'Project Lead' column which is part of your SharePoint list not the 'Project Name' column itself, so you just need to replace the first parameter with SharePoint list name. And in order to view, set the Value property of your second dropdown as 'Project Name'. Also as better way to compare, I have replaced DisplayName
with Email
.
Upvotes: 0