cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
tagustin2020
Impactful Individual
Impactful Individual

Shipping Contents Collection Won't Write to SharePoint

@RandyHayes 

 

Hello Randy,

 

Me again! I'm trying to follow what you taught me in the Budget app I was working on as I have a similar use case with the Shipping App in the sense that I want to write the contents people wish to ship to a separate SharePoint list. I'm able to gather all of entries into the gallery as seen below, but I get errors when I try to write the Collection back to SharePoint via the Submit Form button. I've attached my screenshots and formulas in the Word doc (3 pgs). Would you mind taking a look and seeing if you can spot what I'm doing wrong? Thanks a mil, Teresa

 

SubmitFormSS.png

1 ACCEPTED SOLUTION

Accepted Solutions

@tagustin2020 

Not so much because the Created date (SharePoint column) will not be available at the point that you are doing the Collect to the datasource.

But, there is no reason you can't include that in the collected record.

i.e.

{Tile: tiItemDescription.Text,
     Value: tiValue.Text, //is this not a numeric also?? If so, Value(tiValue.Text)
     Quantity: Value(tiQty.Text),
     TotalValue: lblSubTotal.Text, //is this not a numeric also?? If so, Value(lblSubTotal.Text)
     Handling: ddHandling.Selected,
     UOM: tiUOM.Text,
     Year: Year(Now()),
     Quarter: RoundUp(Month(Now())/3, 0),
     Month: Month(Now())
    }

 

They would essentially reflect what was in the Created columns (once it is written).

 

_____________________________________________________________________________________
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

View solution in original post

16 REPLIES 16
RandyHayes
Super User III
Super User III

@tagustin2020 

The names of the columns of your Collection MUST match exactly to the Real name of the SharePoint list columns and, they must have the correct types in them.

 

I see in your collection definition that you have a "TotalValue" column, yet in your List definition, there appears to be a "Total Value" name.  If the real name of that column is "TotalValue" then you are fine, but I suspect not.

 

Also, for things like the Handling column - it is a choice column, yet you are setting it to a text value (ddHandling.Selected.Value)

If that dropdown items is Value based, then you can change the assignment of the value to ddHandling.Selected

If not, then set it to: {Value: ddHandling.Selected.Value}

 

Everything must match exactly!

_____________________________________________________________________________________
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

@RandyHayes 

 

Hi Randy,

 

Here is a snapshot of my Collection columns. The internal name of my 'Total Value' SharePoint column is TotalValue.

 

Collection1ItemExample.png

The Items property of my dropdown is:

ValueTypeSS.png

 

Based on your guidance I changed the Collect formula for the Add button to this. I realized I was pointing to the wrong label for TotalValue so I fixed it.

Newaddbuttonss.png

 

A reset for the lblSubTotal.Text doesn't appear possible and shouldn't be necessary since it is based on a math formula (value * qty), right?

TV.HandlingChangess.png

Here are the label formulas in the gallery below input row.

CollectionTextss.png

My Collect formula is still not working. Wish I could spot what I am doing wrong. The problem has to be in either the Handling or the Value or TotalValue fields, right? I don't have any spaces in the internal names of my SharePoint columns so I haven't been able to spot the error yet.

Collect('Shipping Request Contents',colContents);

 

Thank you,

Teresa

 

RandyHayes
Super User III
Super User III

@tagustin2020 

So, what is the exact error that you are getting from the formula at this point?

_____________________________________________________________________________________
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

@RandyHayes 

 

Good morning Randy,

 

I've tried the formula in both the OnSelect of the SUBMIT FORM button and the OnSuccess property of frmMaster. I assume the latter is the correct place to write it as I want the contents to be connected to the req number that will be created once frmMaster is successfully submitted. 

 

frmMasterOnSuccessCollectError.png

 

When I saw the "Incompatible type" error message I double-checked my Quantity column in the SharePoint list and it is a Number type column. The format of the Text input field was set to Text so I changed it to Number, but it did not resolve the error. I'm not sure what to try next.

 

NewQtyNumber.png

 

I currently have 3 different ID types. The internal SharePoint ID, the 5-digit ID I am showing in the gallery since I don't have enough space for the long one, and the long ID I would like to record for the sake of reporting purposes (a separate screen I plan to build for the Logistics team).

 

ID-types.png

Here is the current OnSuccess formula for frmMaster:

Patch(FormPageStatus, {Page: CurrentPage.Page}, {Status: "Complete"});
UpdateContext({conFinalConf:true});
UpdateIf('Domestic Shipping Requests', ID=Self.LastSubmit.ID,{'Request Number': Self.LastSubmit.ID + 10000});
Collect('Shipping Request Contents',colContents)

 

The first line updates the progress tracker. The second line launches a confirmation pop-up with further instructions. The third updates the 5 digit ID. The Collect formula is the only piece not cooperating thus far.

 

ConfPopUpFS.png

 

Thanks for helping me Randy. I know you are busy with your own work so I really appreciate it - Teresa

RandyHayes
Super User III
Super User III

@tagustin2020 

Yes, changing the format of a textinput control only changes the format of the control...not it's results.  The Textnput control only has a Text property to tell you what is in the control...and, as its name implies, it is Text.

So your plus formula should be:

Collect(colContents,
    {Tile: tiItemDescription.Text,
     Value: tiValue.Text, //is this not a numeric also?? If so, Value(tiValue.Text)
     Quantity: Value(tiQty.Text),
     TotalValue: lblSubTotal.Text, //is this not a numeric also?? If so, Value(lblSubTotal.Text)
     Handling: ddHandling.Selected,
     UOM: tiUOM.Text
    }
);
Reset(tiItemDescription); Reset(tiValue); Reset(tiQty); Reset(ddHandling); Reset(tiUOM)

If you get the correct column names and the correct datatypes in them, the collect function should work then in your OnSuccess action. 

_____________________________________________________________________________________
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

@RandyHayes 

 

Hi Randy,

 

Sorry for the delay in response. I was inundated yesterday.

 

Thank you so much. Wrapping the Text inputs in the Value function made everything fall into place. I will document this for next time so I don't forget how to handle Number type columns. Obviously, it is core/basic concept that is important to understand if you want things to work properly.

 

I have a quick follow-up question. I don't have a date picker on the screen like I did for my budget app. Is there a way to leverage the internal Created SharePoint column to pick up the Year, Quarter and Month? The formula below of course doesn't work.

 

Year: Year(Created),
Quarter: RoundUp(Month(Created)/3,0),
Month: Month(Created)

 

Kind regards,

Teresa

 

Sorry to interrupt, I just notice a few things that might be helpful to you. 

 

1) You can use the now formula to capture the date without a date picker.  The formula would be Year(Now()). 

 

2) I'd suggest making an extra column called DateNum.  Generally, I do YearMonthDay the formula would be similar to Value(Year(Now())&If(Month>9,Month(Now(),0&Month(Now())&If(Day>9,Day(Now(),0&Day(Now())).  The reason you would want to do this is you can't do > or < for dates.  With a number value, you can use a date picker and convert it to a similar number format and then you can see everything greater than or less than that date.

 

3) When submitting fields, I generally like to submit fields in groups of 5.  It's really hard to figure out what went wrong when submitting 30-40 fields.  However, if you do it in groups of 5 it is easy to identify little things like a misplaced letter in your title or the field format is wrong.  After you know 5 is good, you add another 5 until you're all the way done.  

tagustin2020
Impactful Individual
Impactful Individual

@dyee 

@RandyHayes 

 

Thank you for your input Dyee. I really appreciate how great everyone in the Community is about trying to  help out those who are stuck. I tried the Year:Year(Now()), but it didn't work for me whether I wrapped it in a Value formula or not (my SharePoint column is a Number type column). #3 is good advice. Shane Young talks a lot about taking "baby steps" as a way to approach formulas to make troubleshooting easier. I'm curious to see what Randy will have to say about #2 since he is pretty good at abbreviating formulas. 

 

Have a great day,

Teresa

@tagustin2020 

Not so much because the Created date (SharePoint column) will not be available at the point that you are doing the Collect to the datasource.

But, there is no reason you can't include that in the collected record.

i.e.

{Tile: tiItemDescription.Text,
     Value: tiValue.Text, //is this not a numeric also?? If so, Value(tiValue.Text)
     Quantity: Value(tiQty.Text),
     TotalValue: lblSubTotal.Text, //is this not a numeric also?? If so, Value(lblSubTotal.Text)
     Handling: ddHandling.Selected,
     UOM: tiUOM.Text,
     Year: Year(Now()),
     Quarter: RoundUp(Month(Now())/3, 0),
     Month: Month(Now())
    }

 

They would essentially reflect what was in the Created columns (once it is written).

 

_____________________________________________________________________________________
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

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza Winner Announcement

Please join us on Wednesday, July 21st at 8a PDT. We will be announcing the Winners of the Demo Extravaganza!

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

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