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

How to load edit form in New Form mode if gallery does not return any items

Hi,

 

I have a PowerApp screen showing a gallery and an edit form both tied to same sharepoint list, when clicked on an item on a gallery, relevant info for that item shows up on edit form, there is a '+' on top, on click of which the form loads in new form mode.

 

Now I wanna do something like, on screen load, if the gallery does not return any items, then load the form in new mode directly instead of edit mode, else part should be edit mode, can someone please help me  with formula or something, thanks in advance. 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: How to load edit form in New Form mode if gallery does not return any items

Hi @dmistry ,

Do you want to decide the form's mode by whether "Gallery.selected" is blank?

I suggest you not use whether "Gallery.selected" is blank as the judgment rule of  the form's mode.

Actually, "Gallery.selected" will never be blank value.

If you not select any item in the gallery and not set the gallery's default property, it will be first item by default.

If you set the gallery's default property, it will be the default item by default.

If you select any item, it will be the selected item.

I suggest you use button to decide the form's mode.

For example, if you click the arrow button inside the gallery, the form become edit form.

If you click the "+" button outside the gallery, the form become new form.

Like this:

32001.gif

 You could set the arrow button's OnSelect: 

EditForm(Form1)

set the "+" button's OnSelect:

NewForm(Form1)

 

Then the form's mode will change based on which button you click.

 

 

 

Best regards,

Community Support Team _ Phoebe Liu
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

3 REPLIES 3
Highlighted
Super User III
Super User III

Re: How to load edit form in New Form mode if gallery does not return any items

Once the gallery is directly linked to the form, there will always be items in it unless you filter the gallery to return blank. I suggest you rather insert another button and set it OnSelect to Newform(YourFormName) so that when ever you click it will be a new form. You can do same form edit form EditForm(YourFormName)
Highlighted
Super User III
Super User III

Re: How to load edit form in New Form mode if gallery does not return any items

Hi @dmistry 

If your Gallery has an Items property of "MyCollection".  

Set the DefaultMode property of your Edit form to: 

 

If(!IsEmpty(MyCollection),FormMode.Edit,FormMode.New)

 

You can use the formula in your gallery's Items property instead of "MyCollection". 

Highlighted
Community Support
Community Support

Re: How to load edit form in New Form mode if gallery does not return any items

Hi @dmistry ,

Do you want to decide the form's mode by whether "Gallery.selected" is blank?

I suggest you not use whether "Gallery.selected" is blank as the judgment rule of  the form's mode.

Actually, "Gallery.selected" will never be blank value.

If you not select any item in the gallery and not set the gallery's default property, it will be first item by default.

If you set the gallery's default property, it will be the default item by default.

If you select any item, it will be the selected item.

I suggest you use button to decide the form's mode.

For example, if you click the arrow button inside the gallery, the form become edit form.

If you click the "+" button outside the gallery, the form become new form.

Like this:

32001.gif

 You could set the arrow button's OnSelect: 

EditForm(Form1)

set the "+" button's OnSelect:

NewForm(Form1)

 

Then the form's mode will change based on which button you click.

 

 

 

Best regards,

Community Support Team _ Phoebe Liu
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

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,664)