cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Fedir_Redko
Level: Powered On

Update label with the data from user search

The problem is next I have a label which displays name of the user with assigned to him record in the Sharepoint list. Formula for the display is next: 
First(First(Filter(CreateTaskList, ID = ThisItem.ID)).'Assigned to').DisplayName - CreateTaskList is my Sharepoint list, Assigned to is a Person field in the list.
Also I have a gallery and text input field which I use for the search of the users for assigning of the records when I'm updating it. So the point is that I wan't to display by default Users name to whon that record is already assigned but after the user starts to edit it and taps on the result from the gallery (user search) Label should be updated with the new users name. So than I can use that field for the update of the record.


3 REPLIES 3
Dual Super User
Dual Super User

Re: Update label with the data from user search

Hi @Fedir_Redko 

 

For the label text property use

 

If(!IsBlank(SelectedPerson),SelectedPerson.DisplayName, First(First(Filter(CreateTaskList, ID = ThisItem.ID)).'Assigned to').DisplayName))

 

This will check to see if SelectedPerson has a value - if yes (that means user has searched) then set value of label from the SelectedPerson object using SelectedPerson.DisplayName else get the value from the original logic

 

On Screen Visible you can ensure to set SelectedPerson to Blank()

OnVisible

UpdateContext({SelectedPerson:Blank()})

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Community Support Team
Community Support Team

Re: Update label with the data from user search

Hi @Fedir_Redko ,

Could you please share a whole screenshot about your app's configuration?

Could you please share a bit more the 'Assigned to' column? Is it a Person column, which has enabled "Allow multiple selections" option?

Where do you put your Label? Within a Gallery?

 

Based on the needs that you mentioned, I have made a test on my side, please take a try with the following workaround:

Set the Text property of the Label (LabelValueHover_2) to following:

If(
!IsBlank(SelectedPerson),
First(SelectedPerson.'Assigned to').DisplayName,
First(First(Filter(CreateTaskList, ID = ThisItem.ID)).'Assigned to').DisplayName )

Set the OnSelect property of the Label (LabelValueHover_2) to following:

UpdateContext({
                           HidePeopleGallery: false,
                           IsShowPeopleDetails: false,
                           SelectedPerson: Blank()            /* <-- Add this formula */
})

Set the OnVisible property of the current screen (which contains the Gallery ) to following:

UpdateContext({SelectedPerson: Blank()})

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Fedir_Redko
Level: Powered On

Re: Update label with the data from user search

Hi @RezaDorrani 
Thank you for your answer!
Yes it helps now it's updating data  after choose of the field in the Gallery. 
But it's apllying result to the all fields in the gallery. 
Is it possible to make it display the chosen by the user name only in the one records in which he was updating it?
In the attachment I have added screenshot with outcome of the action of choose. 
Also one extra problem is update of the field in the case if the user leaves it empty. So if the user leave input field empty and than cancel edit the field will still be empty.
I have added update of the context fot the cancel and update buttons but it works only if the data is input in the field. 
Thank you for the answer!


Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 281 members 4,964 guests
Please welcome our newest community members: