cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Pushthe
Helper II
Helper II

hide gallery if nothing is selected

I have an app with only 1 screen and I am doing everything on this one screen.

 

There is a gallery that is conected to a SharePoint list in there and there is a DatePicker there too.

 

I have Filtered my Gallery so that it sorts results to me based on the date picker.

 

When i start the app the Gallery is either empty or there are some results in it depending on the Today().

 

I would preffer if the Gallery was empty every time until a date from the date picker gets selected.

Is there a way for me to do this?

 

I have tried following a suggested solution from a similar question. HERE.


By Shanescows
I am guessing something you changed is causing this. No problem, we will ignore it, and make your form act the way you want in this scenario. 

1. For your Display Form set the Visible property to ShowMyForm
2. In your Gallery. Change the > icon to be Select(Parent);UpdateContext({ShowMyForm: true})
3. For the Screen that these items are on: change the OnVisible property for the screen to 
   UpdateContext({ShowMyForm: false})

All done. 

To enhance the app a little I would add a Label that says "please select an item to see the details" and put it in the same spot as the display form. Then set the labels Visible property to !ShowMyForm How Fancy is that?

I couldnt figure out how i could do this and still remain on the same screen.

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User III
Super User III

@Pushthe 

So you mention "until a date in the date picker gets selected".  I assume you already have the datepicker with Today in it - so therefore, it is selected!

I would say you have 1 of two possible approaches to this:

1) Set the Visible property of your Gallery to :  CountRows(yourGalleryName.AllItems)>0

    This will hide the gallery if there is nothing in it.

 

2) Set your datepicker to Blank() and not have it default to Today. Then set your Gallery Visible to: !IsBlank(yourDatePicker.SelectedDate)

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

2 REPLIES 2
RandyHayes
Super User III
Super User III

@Pushthe 

So you mention "until a date in the date picker gets selected".  I assume you already have the datepicker with Today in it - so therefore, it is selected!

I would say you have 1 of two possible approaches to this:

1) Set the Visible property of your Gallery to :  CountRows(yourGalleryName.AllItems)>0

    This will hide the gallery if there is nothing in it.

 

2) Set your datepicker to Blank() and not have it default to Today. Then set your Gallery Visible to: !IsBlank(yourDatePicker.SelectedDate)

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

Option 1 could work ok except on those days when i actually have items in the results.

 

Option 2 looks like a better option as my Results are always hidden.

 

Thank you for this solution.

 

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

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (70,441)