cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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({searchTermSmiley Very HappyataCardValue48.Text,top:10}),{DisplayNameSmiley Very HappyisplayName}),"CustomSelected",false)

and 

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))

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
firstImage

PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.

firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

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