web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id : KdtjtluIMD+o6QOYSSJ+aV
Power Apps - Building Power Apps
Answered

Shipping Contents Collection Won't Write to SharePoint

Like (0) ShareShare
ReportReport
Posted on 7 Jun 2021 19:27:17 by

@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

Categories:
I have the same question (0)
  • RandyHayes Profile Picture
    76,291 Super User 2024 Season 1 on 07 Jun 2021 at 19:33:43
    Re: Shipping Contents Collection Won't Write to SharePoint

    @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!

  • tagustin2020 Profile Picture
    on 07 Jun 2021 at 20:27:15
    Re: Shipping Contents Collection Won't Write to SharePoint

    @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 Profile Picture
    76,291 Super User 2024 Season 1 on 08 Jun 2021 at 14:03:38
    Re: Shipping Contents Collection Won't Write to SharePoint

    @tagustin2020 

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

  • tagustin2020 Profile Picture
    on 08 Jun 2021 at 15:15:43
    Re: Shipping Contents Collection Won't Write to SharePoint

    @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 Profile Picture
    76,291 Super User 2024 Season 1 on 08 Jun 2021 at 16:13:22
    Re: Shipping Contents Collection Won't Write to SharePoint

    @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. 

  • tagustin2020 Profile Picture
    on 09 Jun 2021 at 16:27:17
    Re: Shipping Contents Collection Won't Write to SharePoint

    @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

     

  • dyee Profile Picture
    145 on 09 Jun 2021 at 16:50:35
    Re: Shipping Contents Collection Won't Write to SharePoint

    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 Profile Picture
    on 09 Jun 2021 at 17:54:14
    Re: Shipping Contents Collection Won't Write to SharePoint

    @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

  • Verified answer
    RandyHayes Profile Picture
    76,291 Super User 2024 Season 1 on 09 Jun 2021 at 19:02:00
    Re: Shipping Contents Collection Won't Write to SharePoint

    @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).

     

  • RandyHayes Profile Picture
    76,291 Super User 2024 Season 1 on 09 Jun 2021 at 19:06:23
    Re: Shipping Contents Collection Won't Write to SharePoint

    @dyee 

    I'm not entirely sure what you mean by #2.  You can most certainly use the < and > on dates.

    As for #3, if you've not used the monitor tool to diagnose issues with submitting to your datasource, I would suggest it highly as it will always tell you exactly what the issue is and you can correct from there.  So, 5 or 50 doesn't make a difference as you'll be able to quickly see the problem in the monitor tool.

    However, in relation to misplaced letters/misspelling, in general, you should not be using column names unless they are directly coming from the datasource in the record schema.  The more you alter, the harder it is to design your app and the more problems you will have to troubleshoot.

     

    Thanks for chiming in though...sometimes the more input the better!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 629 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 397 Super User 2025 Season 2

#3
wolenberg_ Profile Picture

wolenberg_ 232 Moderator

Last 30 days Overall leaderboard
Loading complete