web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Adding Columns Changes...
Power Apps
Unanswered

Adding Columns Changes the data in my Gallery

(0) ShareShare
ReportReport
Posted on by 134

Hi,

I've been learning Power Apps and have been having trouble searching the data in my gallery since none of the columns in my SP list are single text columns, but rather lookup or choice columns. I've looked up solutions to this which include the "AddColumns" function, which I tried and after I'm finished writing the function below, it changes the way I've configured the data in my gallery and doesn't allow me to add or remove fields.

 

Here is a screen shot of my function

LS579_0-1660663799815.png

 

I am essentially connecting to a SharePoint calendar list.

 

Thanks!

Categories:
I have the same question (0)
  • Verified answer
    RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @LS579 

    If that is a Choice column, then change your Formula to the following:

    Search(
     AddColumns('ATCNA Cincinnati On Call Calendar',
     "_PrimaryOnCall", 'Primary On Call'.Value
     ),
     txtSearch.Text,
     "_PrimaryOnCall"
    )

    Two things...

    1) You will need to single quote your actual column as seen above and reference the Value column of that Choice record to get the value for your new column.

    2) Avoid using the same name for your new column that you already have in your datasource.  This is confusing and will usually lead to an error.  The above prepends it with an underscore.

     

    I hope this is helpful for you.

  • LS579 Profile Picture
    134 on at

    @RandyHayes 

    Thank you. That worked for another column I wanted to search for as it was a choice column, however, the column in my example is a look up column. I read how to write the function for that in another post, but can you combine the two in "items" and what would that look like? The function didn't look much different than what you had above, but somehow it reacts differently. Do you have any insight on that subject?

  • LS579 Profile Picture
    134 on at

    @RandyHayes 

    ... and how do you keep the function from changing my data in my gallery? That was the main issue I was having with trying to use the search function for the lookup column. My gallery fields would change from what I had it set as.

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @LS579 

    Yes, you can add any number of columns you want to be searchable.

    Search(
     AddColumns('ATCNA Cincinnati On Call Calendar',
     "_PrimaryOnCall", 'Primary On Call'.Value,
     "_LookupColumn", LookUpColumNameHere.Value
     ),
     txtSearch.Text,
     "_PrimaryOnCall", "_LookupColumn"
    )

     

    Adding the columns will not impact what you already have.  All of the original columns will be in your items table, so whatever you have in the gallery will not change.

  • LS579 Profile Picture
    134 on at

    @RandyHayes 

    It gives me an error saying that it expects text. 😓

     

    LS579_0-1660741866110.png

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 793 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 333 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard