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
Highlighted
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
Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

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

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Microsoft Business Applications Virtual Launch

Join us for the Microsoft Business Applications Virtual Launch Event on Thursday, April 2, 2020, at 8:00 AM PST.

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (5,711)