cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SonjaK
Level: Powered On

How to hide a Edit.Form as long as no Gallery Item is selected

Hi,

I was looking hours to find a solution... but failed...

 

I have build a tablet app. Connected to SharePoint. On the Screen I have added a Gallery1 and directly next to it a Form.Edit. (I do not want to add a View Form!)

 

Somehow I cannot tell the Gallery that the first item in the Gallery gets selected automatically by browsing to that Screen, so there is no item selected. The Form.Edit is displayed as a edit form without NO content, so if people are not recognizing that they are not in a "selected" item, they start update the record - which is of couse not working....

 

I am aiming for a solution that either the first item in the gallery gets selected automatically OR the Form.Edit is NOT visible till an item in the Gallery gets selected.

 

Gallery "Item" is set to: SortByColumns(SystemPerformance;"Issue_x0020_Date";Descending)

Form.Edit "Item" is set to: GalleryPerformance.Selected

 

I have tried a lot, with Default / First / If / but all has failed. I have also tried to have a text field inserted and make this visible until a Gallery Item gets selected, but with that I failed too.

 

Please be so kind an come back to me with formula - this would be great.

Any help is vey much appreciated. Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: How to hide a Edit.Form as long as no Gallery Item is selected

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?

 

Does that work for you?

 

 

Shane

Shane - Microsoft MVP, YouTube, and PowerApps Consulting for when you are in a bind to get this fixed quickly. And finally we now have PowerApps Training

View solution in original post

11 REPLIES 11
Super User
Super User

Re: How to hide a Edit.Form as long as no Gallery Item is selected

I am a little confused. I made a 2 screen app. Screen 1 has a button that navigates me to screen 2.

 

Screen 2 has a gallery and an edit form. 

 

When I land on Screen 2 the first item in the gallery is always selected. Are you seeing different behavior? 

 

I am pretty sure I can fix your issue. I just want to make sure I am fixing the correct thing first. Cat Happy

Shane - Microsoft MVP, YouTube, and PowerApps Consulting for when you are in a bind to get this fixed quickly. And finally we now have PowerApps Training
SonjaK
Level: Powered On

Re: How to hide a Edit.Form as long as no Gallery Item is selected

Hi,

yes, confirmed. Got the same structure, but my Gallery selects no item automatically.

 

To jump from the Home to the Screen I am using a Button: OnSelect=Navigate(ScrSysPerf;ScreenTransition.None)

so nothing special..

 

Thanks!

bdodu
Level 8

Re: How to hide a Edit.Form as long as no Gallery Item is selected

Did you try the IT basic stuff like: close & reopen the app, delete and recreate the gallery? Sometimes it helps a lot when talking about strange behaviour (it happened to me several times and it really helped me in similar cases).

SonjaK
Level: Powered On

Re: How to hide a Edit.Form as long as no Gallery Item is selected

HI,

close and reopen, refresh - yes. Recreate the Gallery: I wanted to avoid it, as I have optimized it.... Same is true for the form: I did quiet a few changes, format, sizes, that it would take me some time to rebuild it....

 

Thats why I actually try to hide the form if no item is selected - I would not need to rebuild it, because at a certain stage I must ask myself if this tool is even stable enough to launch it to my business partners.

Thanks

Super User
Super User

Re: How to hide a Edit.Form as long as no Gallery Item is selected

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?

 

Does that work for you?

 

 

Shane

Shane - Microsoft MVP, YouTube, and PowerApps Consulting for when you are in a bind to get this fixed quickly. And finally we now have PowerApps Training

View solution in original post

SonjaK
Level: Powered On

Re: How to hide a Edit.Form as long as no Gallery Item is selected

Hi Shane!

 

Thanks a lot for your help - this worked just perfect!

 

Greetings,

Sonja

pinarrehber
Level: Powered On

Re: How to hide a Edit.Form as long as no Gallery Item is selected

Hi, 

 @Shanescows

I have a screen on my app where it shows the tasks assigned to the person with this filter function: 

filter(source1, responsible_email = user().email) 

However my data on excel is more than 2000 rows so I had to divide them into two tables. So a person may have a task related to them in any of these two tables. How can I show this in one gallery? 

I made two galleries on one screen one filtering table1 while the other filtering table2, but then since galleries are overlapping it would confuse the user. If filtering 2 tables in one gallery is not possible, is there a way to hide a gallery when its empty? Or is there any other way of showing data from different sources on one screen? 

 

Thanks, 

Super User
Super User

Re: How to hide a Edit.Form as long as no Gallery Item is selected

@pinarrehber Use the Collect function to make a collection that has both data sets in it then display that in your gallery.

Shane - Microsoft MVP, YouTube, and PowerApps Consulting for when you are in a bind to get this fixed quickly. And finally we now have PowerApps Training
pinarrehber
Level: Powered On

Re: How to hide a Edit.Form as long as no Gallery Item is selected

hi 

@Shanescows

Can you tell me how the formula will look like? 

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 (Last 30 Days)
Users online (6,904)