Power Apps Setting Multiple Default Selections in Office 365 User Combo Boxes|Splitting one-line text as well.

In a previous article I wrote about how to show Office365 users in the combo box and how to select users by default, but is there a way to select multiple users by default? I was asked how to do that, so I wrote down how to do that.

スポンサーリンク

What we want to do

Combo box to list users using SearchUser’s V1 like this and
Prepare a combo box to list users using V2,
When we have information that identifies multiple users (in this case, multiple email addresses in a collection), we want to select these users by default in a combo box.

How to select by default

SearchUser V1

First, here is the formula for multiple selections by default in the V1 combo box.

For all items (ForAll), use the SearchUser function to specify a default, similar to the singular selection I wrote about in the previous article.

Since the results of the SearchUser function are returned in a table (since there can be more than one search result), the First function is used to specify the first search result.

SearchUser V2

Multiple selection by default in V2 is also based on the same concept as V1, and the following formula is used.

The SearchUser inside is now V2, and the return value of the SearchUserV2 function has added “.value”, but almost nothing else has changed.
※The default selection is still possible in SearchUserV1, but the versions should be matched.

Restore selections when multiple users’ information is contained in a single line of text

Multiple users’ information may be stored for a single item in the SPO list, using a delimiter character (in this case “;”).

Consider an expression that restores this to the combo box.

SearchUser V1

When SerachUser V1 is used, the following equation can be used.

Simply change the first argument of ForAll to the text split by Split.
The Filter inside will get rid of “empty array items” that may be created when splitting with the Split function.

SearchUser V2

The concept is the same for SerachUser V2, which allows multiple selections using the following formula.

As before, I just set the SearchUser inside to V2 and added “.value” to the return value of SearchUserV2.

Related Articles

コメント

タイトルとURLをコピーしました