cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
kdunk
Frequent Visitor

Create record and dynamically update gallery as data is entered in a new form

Hello all.  I could really use help on this, since this may be the last piece I need before sharing the app with my coworkers.

 

I need to create a new record in my SP list prior to saving a new form and I need the gallery to show, not only what people have entered and saved in a completed form, but also what they're currently entering in a new form.  I don't necessarily need each field to appear in the gallery as data is entered, but I need the first few fields to show, which includes 'Type of Sweep', 'Plaza', 'Employee', and 'Start Time'.  The remaining fields can be added to the gallery when the individual saves the completed form.  I have no clue what to do here.

 

Also not sure what I'm doing wrong but my date/time fields aren't resetting with a new form.

 

Gallery.PNG

New Form.PNG

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-yutliu-msft
Community Support
Community Support

Hi @kdunk ,

Do you want to display not only the submitted data but also the entering data in the gallery?

Please notice that: if you set the gallery's Items to one table , it will only display the items existing in that table.

The item that has not submitted does not exists in the table. So the gallery could not display that kind of data.

 

However, here's an alternative solution:

make the gallery display a collection, not the data source directly

when you are typing data in the new item, you will update that collection

when you submit the new form, you will update your data source

 

I've made a similar test for your reference:

1)set the app's OnStart:

ClearCollect(collection1,datasourcename)

2)set the gallery's Items:

collection1

3)set the add item button's OnSelect:

NewForm(formname);
ResetForm(formname);
Patch(collection1,Defaults(collection1),{'Type of Sweep':""})
//create a new item in the collection

4)set the new form's data source:

datasourcename

4)set 'Type of Sweep' drop down's OnChange:

Patch(collectoion1,Last(collection1),{'Type of Sweep' :'Type of Sweep'datacardname.Update})

set 'Plaza' drop down's OnChange:

 

Patch(collectoion1,Last(collection1),{'Plaza' :'Plaza'datacardname.Update})

 

set 'Employee' drop down's OnChange:

 

Patch(collectoion1,Last(collection1),{'Employee' :'Employee'datacardname.Update})

 

set 'Start Time' drop down's OnChange:

 

Patch(collectoion1,Last(collection1),{'Start Time' :'Start Time'datacardname.Update})

 

//update the last record in the collection

4)set the submit button's OnSelect:

SubmitForm(Formname);ClearCollect(collection1,datasourcename)

 

 

5)set the cancel button's OnSelect:

Remove(collection1,Last(collection1))
//delete the record that you create

 

Then when you open the new form, you will create an item in the collection. When you enter data in the new form, you will update data in the collection. When you submit the form, you will submit the form, you will save data to your data source and update the collection.

 

 

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

2 REPLIES 2

that's not going to work---data entered on a new form is not saved until the form is submitted, so you aren't going to see it in your gallery until the record is created.

v-yutliu-msft
Community Support
Community Support

Hi @kdunk ,

Do you want to display not only the submitted data but also the entering data in the gallery?

Please notice that: if you set the gallery's Items to one table , it will only display the items existing in that table.

The item that has not submitted does not exists in the table. So the gallery could not display that kind of data.

 

However, here's an alternative solution:

make the gallery display a collection, not the data source directly

when you are typing data in the new item, you will update that collection

when you submit the new form, you will update your data source

 

I've made a similar test for your reference:

1)set the app's OnStart:

ClearCollect(collection1,datasourcename)

2)set the gallery's Items:

collection1

3)set the add item button's OnSelect:

NewForm(formname);
ResetForm(formname);
Patch(collection1,Defaults(collection1),{'Type of Sweep':""})
//create a new item in the collection

4)set the new form's data source:

datasourcename

4)set 'Type of Sweep' drop down's OnChange:

Patch(collectoion1,Last(collection1),{'Type of Sweep' :'Type of Sweep'datacardname.Update})

set 'Plaza' drop down's OnChange:

 

Patch(collectoion1,Last(collection1),{'Plaza' :'Plaza'datacardname.Update})

 

set 'Employee' drop down's OnChange:

 

Patch(collectoion1,Last(collection1),{'Employee' :'Employee'datacardname.Update})

 

set 'Start Time' drop down's OnChange:

 

Patch(collectoion1,Last(collection1),{'Start Time' :'Start Time'datacardname.Update})

 

//update the last record in the collection

4)set the submit button's OnSelect:

SubmitForm(Formname);ClearCollect(collection1,datasourcename)

 

 

5)set the cancel button's OnSelect:

Remove(collection1,Last(collection1))
//delete the record that you create

 

Then when you open the new form, you will create an item in the collection. When you enter data in the new form, you will update data in the collection. When you submit the form, you will submit the form, you will save data to your data source and update the collection.

 

 

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 Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (3,523)