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 / Combobox Patch Function
Power Apps
Unanswered

Combobox Patch Function

(0) ShareShare
ReportReport
Posted on by 2

I'm at my wits end and need some help figuring out why my patch function isn't working correctly. 

 

I have multiple dataverse tables that I need to grab data from and post the results of my form to a master table. 

 

To achieve this, I have a combo box to select a value from one of my data sources. Once that is selected, I want to also grab additional values from that row in the table to ultimately post the info to a master data table. So, one selection... post multiple results. 

 

Patch(
DumpLoads_1,
Defaults(DumpLoads_1),
{
Dumpload_FieldNumber: ComboBox1.Selected.'Field Number', //patches correctly
Dumpload_Project: ComboBox1.Selected.Field_Project, //patches a blank even though there is data in that field
Dumpload_FarmerName: ComboBox1.Selected.Field_Farmer, //patches correctly
Dumpload_TruckNumber: ComboBox2.Selected.'Truck Number',
Dumpload_Tons: Label1_2.Text //patches correctly based on the lookup but is not practicle.
}
);
If(
// check if there are errors
!IsEmpty(Errors(DumpLoads_1)),
// if true, show any error message
Notify(
"Data submission failed",
NotificationType.Error
),
// else, go to success screen
Navigate('Success Screen');
)

 

The code works great for the primary text that is selected in the combobox ComboBox1.Selected.'Field Number', it also works for the secondary line of data shown in the combo box ComboBox1.Selected.Field_Farmer. However, any other value i want to grab like ComboBox1.Selected.Field_Project doesn't write back during the patch and also returns a "Blank" when just looking at the code in powerapps. 

 

However, If i create a label using the lookup function LookUp(Field, Field_FieldNumberAsText = ComboBox1.Selected.'Field Number').Field_Project and then write the results of that lookup it works fine. But I am going to be grabbing 50 objects to write back to the master list and doing a lookup for that many labels is a terrible idea for performance and I'm sure not a best practice. 

 

What am I missing here? Do i need to do a lookup in the patch function first so that the referenced table data has a reference? I know it is something simple but I can't figure it out. 

 

Thanks for your help

 

 

Categories:
I have the same question (0)
  • rnav23 Profile Picture
    2 on at

    Wow! Thanks so much! All 3 of these solutions worked in some form. I went the route that @Mudassar_SZ365 recommended as it gave the best result. I'm posting my code here to hopefully help the next person. Thanks everyone, I spent hours on this and you solved it in 2 minutes. Marking this a solved.

     

    Set(
    varSelectedItem,
    LookUp(Field, 'Field Number' = ComboBox1.Selected.'Field Number')
    );
    Set(
    varSelectedItem2,
    LookUp(Truck, 'Truck Number' = ComboBox2.Selected.'Truck Number')
    );

    Patch(
    DumpLoads_1,
    Defaults(DumpLoads_1),
    {
    Dumpload_FieldNumber: varSelectedItem.'Field Number', 
    Dumpload_Project: varSelectedItem.Field_Project, 
    Dumpload_ActualMiles: varSelectedItem.Field_ActualMiles,
    Dumpload_FarmerName: varSelectedItem.Field_Farmer,
    Dumpload_TruckNumber: ComboBox2.Selected.'Truck Number',
    Dumpload_Carrier: varSelectedItem2.Truck_Carrier,
    Dumpload_Tons: varSelectedItem2.Truck_Tons
    }
    );
    If(
    // check if there were any errors when dumpload submitted
    !IsEmpty(Errors(DumpLoads_1)),
    // if true, show any error message
    Notify(
    "Dumpload submission failed",
    NotificationType.Error
    ),
    // else, go to success screen
    Navigate('Success Screen');
    )

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