I'm fairly new to Power Apps and learning as I build.
I have a form that users will submit periodically. The project information will stay the same while the reporting fields will change. After the first time they submit the form for a project, I want the project information to auto-populate. I'm using a SharePoint list as my data source. So far, I have been able to use the LookUp function in the Default property of the text, date, and choice fields and haven't had any issues. As an example, I set the Default property of the Title field to:
LookUp(DataSource, ProjectCode=DataCardValue2.Text, Title).
I'd like to have the form also auto-populate a person field based on the project code text field (for example, when a project code is entered, I want the project manager to auto-populate), but I get the following error when I attempt the same syntax as above:
"Expected Record value.
The property on this control expects Record values. The rule produces Table values which are incompatible."
Are there extra steps I need to take to auto-populate a person field like this? Is it possible to auto-populate it based on a text field?
Hi @Esaki_28 ,
You need the Combo Box output at OutputHere (DataCardValue10.Selected.????), but from what you have posted, this may be what you are after
{
OutputHere:
If(
'New Task'.Mode = FormMode.New,
Filter(
Activities,
Project in DataCardValue10.SelectedItems
).'Activity Name'
)
}
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
MVP (Business Applications) Visit my blog Practical Power Apps
Hi @WarrenBelz ,
Auto-populate field with choice data type based on another field value selected with choice data type
I have a form that users will create. In this table I am having two fields having one-many relationship, Now I want to populate one field value based on another field value.
I tried this formula in DefaultSelectedItems : If('New Task'.Mode = FormMode.New,LookUp(Activities, Project = DataCardValue10.SelectedItems,'Activity Name')
But I received this error : "Incompatible types for comparison. These types can't be compared: Record, Table."
Looking forward for your support.
Thank you! That fixed it!
@fhamm ,
You need to treat DefaultSelectedItems as a Table
{DisplayName: LookUp(DataSource, ProjectCode=DataCardValue2.Text, ProjectLead.DisplayName)}
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
MVP (Business Applications) Visit my blog Practical Power Apps
At one point, the second syntax that I tried -- LookUp(DataSource, ProjectCode=DataCardValue2.Text, ProjectLead.DisplayName) -- did work, but it broke at some point. I also tried it in a new form and received a new error:
I tried different syntax and received a new error:
LookUp(DataSource, ProjectCode=DataCardValue2.Text, ProjectLead.DisplayName) and got the following error:
"Incompatible types for comparison. These types can't be compared: Text, Control."
The person field Project Lead is multiple select. I'm trying to lookup the Project Lead value in the same table as the Project Code value.
For context, this form is collecting data from the same project(s) over multiple months. I don't want users to have to enter data that remains the same over the course of the year and only have to enter data that changes per month. I want to lookup the Project Lead person field based on Project Code in the same table, looking for an earlier entry. I was able to do this with other field types pretty easily, but keep running into problems with the person field type.
Sure, here's the screenshot:
In the DefaultSelectedItems property, I have the following:
LookUp(DataSource, ProjectCode=DataCardValue2.Text, ProjectLead) with ProjectLead being the person field that I want auto-populated based on the ProjectCode text field.
Hi @fhamm ,
Could you please provide some screenshots of the error message?
Is your Person column multi-select?
In my test, my three items are stored in list3. When adding a new item in list2, as long as you enter an existing item in list3, the manager will be automatically filled in the person field in list2.
Best Regards,
Dezhi
WarrenBelz
146,524
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,906
Most Valuable Professional