cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
stapes
Post Prodigy
Post Prodigy

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
v-xida-msft
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
mdevaney
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." 

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

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

PowerAddict
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

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

And DataSource is the Items property of the gallery?

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

v-xida-msft
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
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (45,911)