cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Lauren_
Advocate IV
Advocate IV

Take people names & fill in text

Hi everyone, bit of a headscratcher here - I feel like it should be simple enough but maybe I am not looking at it in the right way!


I have a multi-select people field (using office365users), I'd like to populate a text field based on the selection here (ie. if they choose joe bloggs, the text will say Room 1). However they may choose multiple (Joe Bloggs & Jane Doe), in which case I'd like it to say Room 1, Room 2. 

 

I can get a single result from If("Joe Bloggs" in DataCardValue14.SelectedItems.DisplayName, "Room 1",""), but cannot seem to work out how to do multiple. I've tried doing multiple label boxes to populate based on the previous statement and then trying to compile a single statement (Room 1, room2) elsewhere but it comes up false.

 

Can someone help my poor frazzled brain please? 🙂

1 ACCEPTED SOLUTION

Accepted Solutions
v-yutliu-msft
Community Support
Community Support

Hi @Lauren_ ,

Do you mean that:
if you select "Joe Bloggs"  in DataCardValue14, the field display as "Room 1"

if you select "Jane Doe" in DataCardValue14, the field display as "Room 2"

if you select Joe Bloggs & Jane Doe, the field display as "Room 1, Room 2"?

If so, you could set the textinput's Default like this:

Concatenate(           
            If("Joe Bloggs" in DataCardValue14.SelectedItems.DisplayName&&
               CountRows(DataCardValue14.SelectedItems)=1,
               "Room 1",
               "Joe Bloggs" in DataCardValue14.SelectedItems.DisplayName&&
               CountRows(DataCardValue14.SelectedItems)=2,
               "Room 1,",
               ""
               ),
            If("Jane Doe" in DataCardValue14.SelectedItems.DisplayName, "Room 2","")
)

 //justify based on different situations

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

11 REPLIES 11
Lauren_
Advocate IV
Advocate IV

I've managed the following but it only looks at two of the labels I've drawn off of the office365 users field - I want it to look at 5 labels and compile a sentence of "Room 1;Room 2;Room 3" as the labels are filled in.

 

If(Label7.Text = "Room 1" Or Label7_2.Text = "Room 1", "Room 1;")

Hi,
What you could do here is to count the number of selected user and add as many rooms as number of users.
Each time you select a user, you increment a variable and based on the value of the variable, you loop the text to concat the Room 1, Room 2, Room X.

The intermediate variable might not be necessary by the way.

Clément

Thank you for replying Clement! Would you be able to give an example so I can better understand please?

v-yutliu-msft
Community Support
Community Support

Hi @Lauren_ ,

Do you mean that:
if you select "Joe Bloggs"  in DataCardValue14, the field display as "Room 1"

if you select "Jane Doe" in DataCardValue14, the field display as "Room 2"

if you select Joe Bloggs & Jane Doe, the field display as "Room 1, Room 2"?

If so, you could set the textinput's Default like this:

Concatenate(           
            If("Joe Bloggs" in DataCardValue14.SelectedItems.DisplayName&&
               CountRows(DataCardValue14.SelectedItems)=1,
               "Room 1",
               "Joe Bloggs" in DataCardValue14.SelectedItems.DisplayName&&
               CountRows(DataCardValue14.SelectedItems)=2,
               "Room 1,",
               ""
               ),
            If("Jane Doe" in DataCardValue14.SelectedItems.DisplayName, "Room 2","")
)

 //justify based on different situations

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Hi @Lauren_ ,


Here is a quick sample which can be improved.
You start with your collection of users and a new one :

ClearCollect(users,YourUserList);
ClearCollect(rooms, Blank());

 

Then i assume you are using a combobox for the multiselect or equivalent (idea is to add the selected items to the rooms collection) :

ForAll(ComboBox1.SelectedItems, Collect(rooms, CountRows(rooms)+1));

and then concat the list :

Concat(rooms, "Room" & Value &" - ")


Hope it helps,

Clément

Hi Clément, I'm not sure I can do a concat on the office365users connector - the users can select from anyone within the business but there are specific people that own the rooms (I'm using the office 365 connector for automated email)/

 

I believe Phoebe's resolution might be what I'm looking for - I will give it a try!

No worries, the idea behind what i suggested was to have something dynamic.
Each time you select a guy in your datacard, you collect it in a collection. And then you can use this concat.

Hi @Lauren_ ,

Have your problem been solved?

If yes, could you mark my answer as solution?

Thanks!

 

 

Bets regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Lauren_
Advocate IV
Advocate IV

Solved! Thank you very much 🙂

 

I used the following:

 

Concatenate(If("Name1" in DataCardValue14.SelectedItems.DisplayName ,"Room 1 C "), If("Name2"in DataCardValue14.SelectedItems.DisplayName , "Room 1 B "),If("Name3" in DataCardValue14.SelectedItems.DisplayName, "Room 2 "),If("Name4" in DataCardValue14.SelectedItems.DisplayName, "Room 3 "),If("Name4" in DataCardValue14.SelectedItems.DisplayName, "Room 4 "))

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

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