cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Continued Contributor
Continued Contributor

Correct formats for Default property of a Gallery is not really explained in Documentation. How do I set it using a variable?

What types of values can I put here?

I have a Table as a DataSource for my Gallery, with columns id, menuLabel and screen.

I want to set my Default to menuLabel=variable

I have tried this - not valid:

Default: {menuLabel:myVariableName}

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Hi @stapes ,

Could you please share a bit more about the formula you typed within the Items property of the Gallery?

Do you want to set a Default value within your Gallery?

 

Based on the needs that you mentioned, I think the LookUp function could achieve your needs. Please consider set the Default property of the Gallery to following:

LookUp(
        "Type Gallery Items formula here",  // Replace here with actual formula typed within the Items property of your Gallery
         menuLabel = variable
)

If you want to highlight display current selected item in your Gallery, please consider set the TemplateFill property of the Gallery to following:

If(
   ThisItem.IsSelected,
   RGBA( 255, 228, 196, 1 ),
   RGBA(0, 0, 0, 0)
)

 

Please consider take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

7 REPLIES 7
Highlighted
Super User III
Super User III

@stapes 

Would this work?

ThisItem.menuLabel

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up." 

Highlighted
Continued Contributor
Continued Contributor

Not really @mdevaney . ThisItem would refer to the item once selected.

ThisItem.MenuLabel is displayed as a Title in the Gallery rows,

Highlighted
Super User II
Super User II

Try LookUp(DataSource, menuLabel = variable) as the Default property of the gallery.

Let me know if this helps.

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.

Thanks!
Hardit Bhatia
https://thepoweraddict.com
Highlighted
Continued Contributor
Continued Contributor

@PowerAddict- I tried this: LookUp(DataSource, menuLabel = "literal value"). This format gave error: Invalid Formula. Expected a value compatible with items.

Highlighted

And DataSource is the Items property of the gallery?
Highlighted

I am going to share an example here. Hopefully that will help you move forward: 

 

I have a gallery with the following values:

1. Items: Users

2. TemplateFill: If(Thisitem.IsSelected, Gray, White) (this selected the first record as the default)

3. Default: First(Filter(Users, 'Full Name' = "Akhil Mahajan"

 

At first nothing happened. I then changed the layout of the gallery, just to figure it out why the default property didn't change and then it worked! I am attaching a GIF that shows this working. 

 

GalleryDefault.gif

 

Let me know if this works. Also, to bring your gallery back to default, you should use the Reset(Gallery) function. 

 

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.

Thanks!
Hardit Bhatia
https://thepoweraddict.com

Highlighted
Community Support
Community Support

Hi @stapes ,

Could you please share a bit more about the formula you typed within the Items property of the Gallery?

Do you want to set a Default value within your Gallery?

 

Based on the needs that you mentioned, I think the LookUp function could achieve your needs. Please consider set the Default property of the Gallery to following:

LookUp(
        "Type Gallery Items formula here",  // Replace here with actual formula typed within the Items property of your Gallery
         menuLabel = variable
)

If you want to highlight display current selected item in your Gallery, please consider set the TemplateFill property of the Gallery to following:

If(
   ThisItem.IsSelected,
   RGBA( 255, 228, 196, 1 ),
   RGBA(0, 0, 0, 0)
)

 

Please consider take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (9,795)