cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Mike8
Level 10

Re: Trouble setting Gallery Default item

Hello Gargoolgala,

Let's say that the name of the  screen that you have the gallery at, is Screen1.
You can add at GalleryNav.Default =  If(App.ActiveScreen=Screen1,{ID:"GeneralAspects",DisplayName:"General"}).

By using the formula above it is like reseting the default value.
App.ActiveScreen=Screen1 goes true when you are at Screen1 and goes false when you navtigate at an other screen. This way the gallery takes the default value that you need.


Gargoolgala
Level 8

Re: Trouble setting Gallery Default item

Mike,

 

thanks again for your assistance.  I got it working slightly different from what you suggested.

 

When I used your option when I navigated to the screen witht he gallery it would briefly appear as the item selected I wanted and would then the form I required to be open when that item is selected would go invisible.

 

My fix was to set the screen to the home screen where I go to select the customers so it would reset back on the home screen but now when I navigate to the screen with the gallry it is "reset" and the correct form is visible 🙂

Anonymous
Not applicable

Re: Trouble setting Gallery Default item

Nice work Mike, that second method got it working for me, plus I think it is an elegant solution.

nishant
Level: Power Up

Re: Trouble setting Gallery Default item

I too faced the similer issue on selection default item in gallery. I have followed following steps to resolve this issue

1. gallery should be simple ie.., nested gallery are not supported to select default values. If you have duplicte values use distinct function insted of filtering by using group by and having distinct values.

 

2. Use default function in gallery to select the default tile in gallery and it only supports item type so use filter function with first or last function or use lookup function.

 

 

items:

bdc604
Level 8

Re: Trouble setting Gallery Default item

Even when clearing the collection, I cannot get Powerapps to select the first Gallery item in a custom view form by default when closing the view form and selecting a different list item. It fires once, the very first time, then nothing when I go to other list items.

Gallery1.Default = First(Collection1)

I tried Screen1.OnHidden = Clear(Collection1) but that didn’t help.

Any suggestions? Perhaps in SP vs stand-alone apps the custom form is never truly hidden, just collapsed out of view, and OnHidden doesn’t get triggered properly?
Mike8
Level 10

Re: Trouble setting Gallery Default item

Hello,

Yes, unfortunately there is no property that resets the default value.
You need to have 
Gallery1.Default = If( vBooleanVariable, First(Collection1) ,Last(Collection1) )

Where vBooleanVariable needs to be a boolean value that changes from true to false or false to true when you want to set the default. You can use a variable if it suits you, that changes everytime that you press a button. 
Button1.OnSelect = UpdateContext({vBooleanVariable:!vBooleanVariable})

skylitedave
Level 10

Re: Trouble setting Gallery Default item

I tried this and it did not throw an error ,but it does not appear to work 😞

 

Try this in the Default of the Gallery

 

Where the sqare brackets shown below have the items listed in the horizontal Gallery

 

First([{ID:"Tasks", DisplayName:"Tasks"}, {ID:"Notes", DisplayName:"Notes"}, {ID:"Docs", DisplayName:"Docs"},{ID:"AcctContacts", DisplayName:"Contacts", Detail_Account_Contact: false }, {ID:"Opps", DisplayName:"Opps"}])

 

Maybe this will lead to another approach ...  Seems like it should work...

 

 

 

 

skylitedave
Level 10

Re: Trouble setting Gallery Default item

I solved this using the technique mentioned in the thread below but had to add  additional steps

 

Make sure to read my post at the end (SkyliteDave) as it adds some important steps that I had to do to get a default tab value to set

 

Hope this helps someone else

 

https://powerusers.microsoft.com/t5/General-Discussion/Select-a-Gallery-item-on-screen-visible/m-p/8...

 

 

 

 

 

iamlee
Level 8

Re: Trouble setting Gallery Default item

Hi All, 

 

I've been following this thread and I can't seem to make the Table(record1,record2) to work. 

 

I have a tabbed form and I have 2 screens for it, one is for display and one is for edit screen. I was able to set the default by creating a collection of gallery items and then I used "First(CollectionName) on the default property of the gallery. The challenge I have is when the user goes to the Edit Screen and changes tab and then goes back to the Display Screen, it is not selecting the Tab that was selected in the Edit Screen. 

 

I can explain to the user they'll have to deal with it but I don't think that's a good UX design, has anyone solved this?

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 339 members 6,137 guests
Please welcome our newest community members: