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

How to use an if statement for the items of the gallery and addcolumn to that gallery

I have a text box  (DataCardValue48) and a gallery (Gallery1).  I have th gallery connected to office365users.  My main app is connected to SQL and trying to create a dynamic people field like sharepoint list people column but has to save a single line of text.  I am trying  to add a column to a gallery to show if it is selected so I can change the template fill to show that it is selected to be saved back as my single line of text.

DataCard update:

If(IsBlank(Gallery1.Selected),DataCardValue48.Text,varDesignLeader)

Textbox default:  

If(IsBlank(varDesignLeader),Parent.Default,varDesignLeader)

 

I have two different formulas for the items of the gallery, One for the add column the other for the Search o365 users. 

AddColumns(ForAll(Office365Users.SearchUser({searchTerm:DataCardValue48.Text,top:10}),{DisplayName:DisplayName}),"CustomSelected",false)

and 

If(Len(DataCardValue48.Text)>0,Sort(Filter(Office365Users.SearchUser({searchTerm:DataCardValue48.Text}),Len(GivenName)>0&&AccountEnabled),GivenName,Ascending),Filter(Office365Users.SearchUser({searchTerm:"zzzz"}),Len(GivenName)>0))

Gallery1 OnSelect: 

Set(varDesignLeader,ThisItem.DisplayName)

I cannot figure out how to combine them.  Any Ideas?

1 REPLY 1
Community Support Team
Community Support Team

Re: How to use an if statement for the items of the gallery and addcolumn to that gallery

Hi @mandy4514 ,

Do you want to addcoulumns to the result of Search o365 users formula?
If so, try this formula:

AddColumns(ForAll(
If(Len(DataCardValue48.Text)>0,
Sort(Filter(Office365Users.SearchUser({searchTermSmiley Very HappyataCardValue48.Text}),
Len(GivenName)>0&&AccountEnabled),GivenName,Ascending),
Filter(Office365Users.SearchUser({searchTerm:"zzzz"}),Len(GivenName)>0)),
{DisplayNameSmiley Very HappyisplayName}
),
"CustomSelected",false)

  //replace the table inside forall function with the result of Search o365 users formula.

 

 

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.

Helpful resources

Announcements
thirdimage

Power Apps 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

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Kudoed Authors (Last 30 Days)
Users online (3,970)