Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

Setting the Default value in a Gallery

Posted on by 86

Hello

 

I have a filter gallery on my form and I am looking to set one of the values as the default.

 

For example:

 

Calcelled

Late

New <- I want to set New as the default

Closed

 

Items code uses a collection and works perfectly

Gallery > Items > Sort(Distinct(EmpCollection, 'Employee Status'.Value),Result,Ascending)

 

Default code does not work

Gallery > Default > LookUp(EmpCollection, 'Employee Status'.Value="New")

 

Error message - Invalid Formula. Expected a value compatible with 'Items'

 

 

Any suggestions?

 

Thanks,

Yoshi

 

  • Golly Profile Picture
    Golly 123 on at
    Setting the Default value in a Gallery
    Yoshimitsu411's fix worked for me, even though I have an if() statement in my Gallery.items! 
     
    Weird.
  • Verified answer
    Yoshimitsu411 Profile Picture
    Yoshimitsu411 86 on at
    Re: Setting the Default value in a Gallery

    I fixed it.

     

    Based on the error message "Invalid Formula. Expected a value compatible with 'Items'", the formula is looking for a record, so I simply wrapped my Items code in a Lookup.

     

    Gallery default code now looks like this.

     

    LookUp(Sort(Distinct(EmpCollection, 'Employee Status'.Value),Result,Ascending), Result="New")

     

    Thanks

    Yoshi

  • Yoshimitsu411 Profile Picture
    Yoshimitsu411 86 on at
    Re: Setting the Default value in a Gallery

    Thanks @Ramole I tried that link and a few others before posting to this forum. Unfortunately, it doesn't work.

     

  • Ramole Profile Picture
    Ramole 4,291 on at
    Re: Setting the Default value in a Gallery

    Hi @Yoshimitsu411 

    This post will explain how to do it 
    How to set default item in a Gallery 

    Gallery control in Power Apps 

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

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,532

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 64,050

Leaderboard