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? 🙂
Solved! Go to Solution.
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,
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?
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,
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,
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 "))
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.
User | Count |
---|---|
202 | |
70 | |
53 | |
49 | |
20 |
User | Count |
---|---|
255 | |
122 | |
83 | |
76 | |
75 |