cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Showing no data after Edit second time

Hi,

 

I'm new one at PA. I'm building an app that controls my projects.

 

First screen I listed my projects (based on sharepoint list):

EduardoSantos_0-1596566133345.png

after clicking at the project, goes to 2nd screen:

EduardoSantos_1-1596566200062.png

in that screen i have some buttons on top (Novo = New; Editar = Edit). my question is about de button "Editar" or Edit.

If I click on it, my form goes to Display Mode edit and I can change whatever I want.

EduardoSantos_2-1596566464034.png

two buttons are shown on the botton of screen (Save and Cancel). So if I click on Save, it saves my edited form perfectly.

EduardoSantos_3-1596566676022.png

If I click again on Edit button, it doesn't show the data anymore.

EduardoSantos_4-1596566863480.png

here are some of my properties:

OnSelect in my gallery:

EduardoSantos_5-1596566982805.png

OnSelect in my Edit button:

EduardoSantos_6-1596567059584.png

OnSelect in my Save button:

EduardoSantos_7-1596567140896.png

 

 

What Am I doing wrong?

 

thaks.

1 ACCEPTED SOLUTION

Accepted Solutions
v-yutliu-msft
Community Support
Community Support

Hi @Anonymous ,

Do you mean that if you click the edit button after you save the form, the form will display nothing?

The reason why you met this problem is that:
if you change the form's mode from view to edit, the form's lastsubmit item will be cleared.

So formname.LastSubmit actually represents blank value. If one edit form's Item is blank, it will display "no item to display".

The solution is: save the formname.LastSubmit as a variable after you submit the form. If you click that edit button, make the form display that variable.

I've made a similar test for your reference:

1)gallery's OnSelect:

EditForm(Form1);Set(mode,"edit")

2)add button's OnSelect:

NewForm(Form1)

3)form's Item:

If(mode="edit",Gallery1.Selected,mode="view"&&!IsBlank(Form1.LastSubmit),Form1.LastSubmit,mode="view"&&IsBlank(Form1.LastSubmit),item)

//if you click the edit button the first time, you will view the selected item.

If you click the save button, you will view the last submit item.

If you click the edit button again, the form's lastsubmit item will be blank. So you will view the variable item(which is the last submit item) 

4)save button's OnSelect:

SubmitForm(Form1);ViewForm(Form1);Set(mode,"view");Set(item,Form1.LastSubmit)

5)edit button's OnSelect:

EditForm(Form1)

 

 

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

10 REPLIES 10
cds
Impactful Individual
Impactful Individual

OnSuccess (Form) = ResetForm(Form)

Anonymous
Not applicable

where should i write this?

cds
Impactful Individual
Impactful Individual

YourForm.OnSuccess

Anonymous
Not applicable

I forgot this, propieties ITEM on my form

EduardoSantos_0-1596568510898.png

 

Anonymous
Not applicable

Now, it goes to "Nothing" at first time I saved. Not worked.

cds
Impactful Individual
Impactful Individual

What is in Default of Form property?

Anonymous
Not applicable

DefaultMode = View

cds
Impactful Individual
Impactful Individual

GalleryiaProjectos is on a different screen?

 

try setting onselect of that gallery to Set(varItem, ThisItem)

 

Then in the Item change galleria.selected to varItem

v-yutliu-msft
Community Support
Community Support

Hi @Anonymous ,

Do you mean that if you click the edit button after you save the form, the form will display nothing?

The reason why you met this problem is that:
if you change the form's mode from view to edit, the form's lastsubmit item will be cleared.

So formname.LastSubmit actually represents blank value. If one edit form's Item is blank, it will display "no item to display".

The solution is: save the formname.LastSubmit as a variable after you submit the form. If you click that edit button, make the form display that variable.

I've made a similar test for your reference:

1)gallery's OnSelect:

EditForm(Form1);Set(mode,"edit")

2)add button's OnSelect:

NewForm(Form1)

3)form's Item:

If(mode="edit",Gallery1.Selected,mode="view"&&!IsBlank(Form1.LastSubmit),Form1.LastSubmit,mode="view"&&IsBlank(Form1.LastSubmit),item)

//if you click the edit button the first time, you will view the selected item.

If you click the save button, you will view the last submit item.

If you click the edit button again, the form's lastsubmit item will be blank. So you will view the variable item(which is the last submit item) 

4)save button's OnSelect:

SubmitForm(Form1);ViewForm(Form1);Set(mode,"view");Set(item,Form1.LastSubmit)

5)edit button's OnSelect:

EditForm(Form1)

 

 

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.

Helpful resources

Announcements
Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Government Carousel

New forum: GCC, GCCH, DoD - Federal App Makers (FAM)

In response to the unique and evolving requirements of the United States public sector, Microsoft has created Power Apps US Government.

Users online (2,652)