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

Community site session details

Session Id : g5UQelLu95Vo2RaCbI5C+f
Power Apps - Building Power Apps
Unanswered

Select function syntax Select(Gallery1, 1) not working

Like (0) ShareShare
ReportReport
Posted on 21 Jan 2020 22:49:40 by 171

I have a gallery galNav1 and wish to have a button (OnSelect) select the 2nd row in that gallery. I am attempting to use the following syntax (on the same screen), but powerapps keeps underlining the formula in red. Any suggestions how to correct my syntax?

 

Select(galNav1, 2)

 

Thanks so much!

Categories:
  • v-siky-msft Profile Picture
    on 22 Jan 2020 at 09:33:48
    Re: Select function syntax Select(Gallery1, 1) not working

    @Madumi 

    Exactly, there is something wrong with Select() function. 

    I will submit this issue to the PowerApps Team. If there is any update, I will post back.

    Sik

  • yashag2255 Profile Picture
    24,647 Super User 2024 Season 1 on 22 Jan 2020 at 06:14:24
    Re: Select function syntax Select(Gallery1, 1) not working

    Hi @Madumi 

     

    Can you try to set up the configuration like:

    Gallery -> Default -> LookUp(ColMenuItems,screen = App.ActiveScreen)

    Make sure that you apply the change on all the screens.

     

    Hope this Helps!

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

  • Madumi Profile Picture
    171 on 22 Jan 2020 at 05:08:27
    Re: Select function syntax Select(Gallery1, 1) not working

    Thx @Anonymous 

    Hmmm, I'm not sure I'm quite following you on the:

    AddColumns(YourDataSource,"screen",Lookup(ColMenuItems,id=[@id],screen))

    (in my Gallery, my "YourDataSource" is ColMenuItems)... Powerapps doesn't seem to take the property...

    Am I right thinking that your example will change the color to show which screen the user is on, but not actually select that row in the gallery? Is there a way to select that row in the gallery?

  • Community Power Platform Member Profile Picture
    on 22 Jan 2020 at 02:19:37
    Re: Select function syntax Select(Gallery1, 1) not working

    Got it! So on your gallery's Items property, you'll use something like this:

    AddColumns(YourDataSource,"screen",Lookup(ColMenuItems,id=[@id],screen))

    Then in your gallery, you can use this according to your example above

    If(ThisItem.screen=App.ActiveScreen.Name,RGBA(255,255,255,1),RGBA(0, 0, 0, 1))

     ---
    If this answered your question, please click "Accept Solution". If this helped, please Thumbs Up.

  • Madumi Profile Picture
    171 on 22 Jan 2020 at 00:37:54
    Re: Select function syntax Select(Gallery1, 1) not working

    @Anonymous 

    Sorry, I wasn't as clear as I could be... What I am attempting to do is have the gallery row which corresponds with the current screen selection to also be selected *within the gallery* i.e. I need a visual indication of the currently selected row so the user can see the selection eg. If(ThisItem.IsSelected,RGBA(255,255,255,1),RGBA(0, 0, 0, 1))

    I guess I'm looking for the mechanism to have that row in the gallery be selected as if the user had just clicked on that row (it's a situation where, having navigated from another screen, the row is not yet selected).

    thanks!

  • Community Power Platform Member Profile Picture
    on 22 Jan 2020 at 00:17:56
    Re: Select function syntax Select(Gallery1, 1) not working
    You could use the screen's OnVisible property to do this formula:

    Set(CurrentRecord,Filter(ColMenuItems,screen=App.ActiveScreen.Name))

    Then use the CurrentRecord variable as your selected item.
  • Madumi Profile Picture
    171 on 21 Jan 2020 at 23:22:24
    Re: Select function syntax Select(Gallery1, 1) not working

    Thx @Anonymous 

    Yes, I was also wondering if the functionality had somehow been retired...

    The use case is that I have a gallery I'm using for navigation, based on a collection, and spread across four screens. Here's the collection:

    ClearCollect(
     ColMenuItems,
     {
     id: 1,
     MenuLabel: "Projects",
     screen: Screen1
     },
     {
     id: 2,
     MenuLabel: "Operating Units",
     screen: Screen2
     },
     {
     id: 3,
     MenuLabel: "Managers",
     screen: Screen3
     },
     {
     id: 4,
     MenuLabel: "Member Agencies",
     screen: Screen4
     }
    )

    Is there another, or a better way in which I can for example trigger menu id: 2 to be selected when the user navigates to Screen2? I have tried using Default on the gallery, but this doesn't work after the 1st navigation away from it (default seems to become cleared, and the last gallery item which was selected, remains selected when the user navigates back to this screen).

    thanks!

  • Community Power Platform Member Profile Picture
    on 21 Jan 2020 at 23:03:12
    Re: Select function syntax Select(Gallery1, 1) not working

    I did find the functionality you need in the docs here

    https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-select

    Select( Control, Row or column, Child Control )

    • Control â€“ Required. The control to select on behalf of the user.
    • Row or column â€“ Not required. The number of row or column (starting with 1) in a gallery control to select on behalf of the user.
    • Child Control - Not required. The child control of the control identified in the 'control' parameter to select.

    but I can't seem to get it to work. I'm not sure if this has been retired without being removed from docs, or if I'm missing something. I'll keep looking.

  • Community Power Platform Member Profile Picture
    on 21 Jan 2020 at 22:56:24
    Re: Select function syntax Select(Gallery1, 1) not working

    What is the use case here? I'm not sure this is possible, and there may be an easier way to accomplish this. I'll try to figure out a way to do this, though.

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410 Super User 2025 Season 2

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 2