cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Smilee279
Resolver I
Resolver I

Creating a new line item from previous form data and append

Hi all!  Relatively new at PowerApps--super stuck on how to attack this issue.  

 

I've got an app that has form data for one Sharepoint list split across two screens.  I've been able to successfully get that working to submit/save to the list.  My next challenge (where I'm stuck) is to copy the first screen (Screen1) data (we'll call this Form1) when a button is clicked and append new data from Form2 in Screen2.  

 

So currently Screen1, Form1 and Screen2, Form2 update the same line in the Sharepoint List. (Like this https://www.youtube.com/watch?v=N8AsxE__Mw8)

 

I would like to create a button on Screen2 to copy the data from Form1 to a new line, and then append it with new data I would fill out in Form2 (and save on a new line in the same Sharepoint List).  (And keep the above functionality).

 

Any help would be appreciated!  

5 REPLIES 5
RandyHayes
Super User
Super User

@Smilee279 

I'd suggest taking a look over my video on splitting forms across screens without losing form functionality.  I believe based on your description, this will be very helpful for you.

 

I hope this is helpful for you.

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

Really want to show your appreciation? Buy Me A Cup Of Coffee!
Smilee279
Resolver I
Resolver I

@RandyHayes  thank you!  The video went over a lot of the stuff I've already done with the form across multiple screens...(and it gave me another way to tackle it!)  I'm trying to basically "submit" on the completed form, and "copy" the data from Form1 and essentially start from Form2.  (hopefully this makes sense).  

Ideally, I could essentially have multiple lines in the sharepoint list with the first few columns with the same exact data, but the last 5 columns would be different.  My goal is to avoid having a source Sharepoint list that is 500 columns wide due to the amount of redundant fields we would have to fill in.  I thought it would be easier to have the first 5 columns of data repeated, with the 5 additional fields unique, then sort by columns later on.

RandyHayes
Super User
Super User

@Smilee279 

First, thanks for watching!!

 

So, I still think what I present there is still what you are looking for.  The bottom line is that the final form has all of the fields in it. So, essentially, you can start with any form/screen you want.

 

Now, reading your second paragraph, this seems a little bit more of a clearer explanation that I didn't pick up on in the first post.  In re-reading it now, it's much clearer.

 

I would suggest having a button to do the copy.

In the OnSelect for that button, set the formula to: UpdateContext({lclCopy: First(SortByColumn(yourDataSource, "ID", Descending))})

 

Now, in your form, you can set the Default properties of the datacards that you want to have copied into, to:

Coalesce(lclCopy.columnName, ThisItem.ColumnName)

 

Just make sure in the OnSuccess action of your form you put this in: UpdateContext({lclCopy:Blank()})

 

 

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

Really want to show your appreciation? Buy Me A Cup Of Coffee!
Smilee279
Resolver I
Resolver I

@RandyHayes Thank you for this--I had engaged MS right before your reply, so I was holding on trying your method to see what they would suggest.  They suggested a similar strategy to your initial post for your video, but advised adding a button and doing the following:

On the OnSelect of the "Add another item" button, 
SubmitForm(Form2); 
Datacard1Form1.Default = globalvariable.SPListColumn1;
Datacard2Form1.Default = globalvariable.SPListCollumn2; etc.

This way each individual datacard's information would be duplicated and passed and we can enter the remaining information in Form2, and SubmitForm(Form2) again to get the second line of information.  I haven't tested this out yet, but part of me is thinking we need to have instead:

 

OnSelect  

SubmitForm(Form2);
NewForm(Form2);

Datacard1Form1.Default = globalvariable.SPListColumn1;
Datacard2Form1.Default = globalvariable.SPListCollumn2; etc.

 

Or am I overthinking this?

Smilee279
Resolver I
Resolver I

So what we tried ended up causing blank line items in my SP List.  

@RandyHayes since I'm still super new at this, your post was the first time I'd heard of "Coalesce" as a function.  Let me do some digging and learn up on that function so I can fully understand if your solution is going to work for what I'm trying to do.

 

Thanks!

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,189)