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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Patching to a List fro...
Power Apps
Unanswered

Patching to a List from a "shopping cart" gallery

(0) ShareShare
ReportReport
Posted on by 577 Super User 2024 Season 1

Hey All,

I have an interesting problem and cant get it to work.

So in my item screen the user selects which devices they need to order.

KRider_0-1652716544517.png

Then in my "confirm" screen I Collect the list made in Product Order. It only stores the CPID and Device Type.

KRider_1-1652716608905.png

Now when I "Place Order" this is my code. For some reason it isn't allowing me to write to each device in my database with the TM information provided in this screen.

 

ForAll(
gly_items.AllItems,
Patch(
CPA_db_master,
LookUp(
CPA_db_master,
'Core Pilot ID'='Core Pilot ID',
{
Assigned:{Value:"Yes"},
Title:txt_cnfm_Title,
MyToyotaID:txt_cnfm_mtid,
Email:txt_cnfm_email,
Role:txt_cnfm_role,
Project:txt_cnfm_project,
Shop:txt_cnfm_shop,
Plant:dpdn_cnfm_plant,
'Date Out':txt_cnfm_date
}
)
)
);
Notify("Your items have been successfully updated!",Success);
Navigate(CPA_legal,ScreenTransition.Cover)

 

So This is only 1 save. I still need to patch another save to "order history"

 

Thank you so much for your help.

 

Kyle

Categories:
I have the same question (0)
  • One Profile Picture
    416 on at

       

  • KRider Profile Picture
    577 Super User 2024 Season 1 on at

    It may not be the code itself? It says object must implement iConvertible. Does this mean my table values don't match the right type of data?

  • One Profile Picture
    416 on at

    @KRider you would be correct that your data types don't match. you will want to declare their data types in your patch statement. 

    {
    Assigned:{Value:"Yes"},

    Title:txt_cnfm_Title.Text,
    MyToyotaID:txt_cnfm_mtid.Text,
    Email:txt_cnfm_email.Text,
    Role:txt_cnfm_role.Text,
    Project:txt_cnfm_project.Text,
    Shop:txt_cnfm_shop.Text,
    Plant:dpdn_cnfm_plant.Text,
    'Date Out':txt_cnfm_date.DateValue
    }

    notice how they are followed by ".Text", that is declaring the data type of the values you are trying to patch to a column in a SharePoint list.

     

    you may also be getting a circular reference from the :

    'Core Pilot ID'='Core Pilot ID',

     you may need to give them unique names or add:

    SharepointListName.'Core Pilot ID'='Core Pilot ID',

     

    ------------------------------------------------------------------------------------------------------------------------------

    Please click "Accept as Solution" if this post answered your question so that it is helpful for people having similar questions. If you found this post helpful smack that Thumbs up button! Thanks!

  • KRider Profile Picture
    577 Super User 2024 Season 1 on at

    I feel like we are almost there!

    So now CPA_db_master.CP_ID = 'Core Pilot ID' gives an error saying incompatible types Table to Number.

    Maybe I can declare this in my Collect?

     

    ForAll(
     gly_items.AllItems,
     Patch(
     CPA_db_master,
     LookUp(
     CPA_db_master,
     CPA_db_master.CP_ID = 'Core Pilot ID',
     { 
     Assigned:{Value:"Yes"},
     Title:txt_cnfm_Title.Text,
     MyToyotaID:txt_cnfm_mtid,
     Email:txt_cnfm_email.Text,
     Role:txt_cnfm_role.Text,
     Project:txt_cnfm_project.Text,
     Shop:txt_cnfm_shop.Text,
     Plant:dpdn_cnfm_plant,
     'Date Out':Today()
     }
     )
     )
    );
    Notify("Your items have been successfully updated!",Success);
    Navigate(CPA_legal,ScreenTransition.Cover)

     

    Collect(
     ProductOrder,
     {
     'Core Pilot ID':Value(ThisItem.CP_ID),
     Category:ThisItem.Category,
     'Device Type':ThisItem.'Device Type'
     }
    )

     

  • Verified answer
    One Profile Picture
    416 on at

    okay so the problem now seems to be coming from your patch statement. when using a lookup, powerapps is expecting a return value, which is where you placed your items that you want patched to your list.
    you are going to want to replace the lookup with a filter. something similar to the following:

     

    ForAll(
    gly_items.AllItems,
    Patch(
    CPA_db_master,
    First(
    Filter(
    CPA_db_master,
    CPA_db_master.CP_ID = 'Core Pilot ID')),
    {
    Assigned:{Value:"Yes"},
    Title:txt_cnfm_Title.Text,
    MyToyotaID:txt_cnfm_mtid,
    Email:txt_cnfm_email.Text,
    Role:txt_cnfm_role.Text,
    Project:txt_cnfm_project.Text,
    Shop:txt_cnfm_shop.Text,
    Plant:dpdn_cnfm_plant,
    'Date Out':Today()
    }
    )
    )
    );
    Notify("Your items have been successfully updated!",Success);
    Navigate(CPA_legal,ScreenTransition.Cover)

    If that still doesn't work I would refer to this post which might point you in the right direction. 

    ------------------------------------------------------------------------------------------------------------------------------
    Please click "Accept as Solution" if this post answered your question so that it is helpful for people having similar questions. If you found this post helpful smack that Thumbs up button! Thanks!

  • KRider Profile Picture
    577 Super User 2024 Season 1 on at

    I changed to a filter, still had a few types not working. I changed my "number" columns on my list to single line text and now everything is working. Thank you so much!

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard