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 with textinpu...
Power Apps
Unanswered

Combobox with textinput showing sum of parts cost

(0) ShareShare
ReportReport
Posted on by 233

Hello,

Right now, I have a form with a dropdown with a parts list and a textinput that displays the cost of the part from the dropdown. Everything works great, but now I need to change the dropdown to a combo box so that I can select multiple parts and the cost of these will be added together and displayed in the textinput box. Then when I submit the form, I need all of the parts that have been selected put into one field ‘Parts Replaced’ and the combined cost to the ‘Parts Cost’ field on the table. Can you show me how this can be done?

 

My current setup:

Parts_List_Dropdown

Sort(Etching_Parts_Lists,'Item Description',Ascending)

 

Part_Cost_DataCardValue1

LookUp(Etching_Parts_Lists,'Item Description'= Parts_List_Dropdown.SelectedText.Value).'Parts Cost'

 

Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    153,024 Most Valuable Professional on at

    Hi @Chrisguff12 ,

    This is not a straight-forward process and what I am supplying should work, but is more syntax guidance to get you on your way. I have it working on a test model here, but have needed to change all the references to the ones you supplied, so if there is an issue please check these and the general logic to what you need. Firstly, if you put this on the OnChange of the Combo Box

    Clear(colCosts);
    With(
     {wCost: Self.SelectedItems},
     Collect(
     colCosts,
     AddColumns(
     wCost As aCost,
     "Cost",
     LookUp(
     Etching_Parts_Lists,
     'Item Description' = aCost.'Item Description'
     ).'Parts Cost'
     )
     )
    )

    Now the Default of your Text box containing the new information would be

    With(
     {
     wCosts: 
     Concat(
     colCosts,
     'Item Description' & ", "
     )
     },
     Left(
     wCosts,
     Len(wCosts) - 2
     )
    ) & " - $" & 
    Text(
     Sum(
     colCosts,
     Cost
     ),
     "[$-en]###,##0.00"
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • Chrisguff12 Profile Picture
    233 on at

    Hello @WarrenBelz 

     

    Thanks for the quick response and for taking the time to customize the formulas to my data.

     

    Both parts you posted are working but for some reason when I select more then one item in the combo box it adds each item twice. 

    Cost of the items:

    Power supply: $346.09 / Laser Tube: $1,295

    Chrisguff12_0-1613784421797.pngChrisguff12_1-1613784466661.png

     

    Also I was wondering is there a way to have the Textinputbox only show the price and not the part names? When I submit the form I would like to have the date look like this in on the table. 

    Parts Replaced Parts costs
    Power supply, Laser Tube$1,641.09
  • WarrenBelz Profile Picture
    153,024 Most Valuable Professional on at

    @Chrisguff12 ,

    See revised code - should work now. A bit tricky when working with this type of control.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • Chrisguff12 Profile Picture
    233 on at

    Hi, @WarrenBelz 

    Thanks that is working better and I'm no longer getting the double results. 

     

    In my table it is only returning the one part in the 'Parts Replaced' Field. And the "Parts cost' Field has the part descriptions with the total price. I am guessing that I need to change my Onsuccess Property of the form in order to get the results I want. I have been trying to use the Split function but cant seem to get the correct parts in the right fields.  

    Current Results:

    Parts ReplacedPart Costs
    Blower 230VBlower 120V, Blower 230V - $2,173.00
    Power SupplyLaser Tube, Power Supply - $1,641.09

     

    I would like it to look like this

    Parts ReplacedPart Costs
    Blower 120V, Blower 230V$2,173.00
    Laser Tube, Power Supply$1,641.09

     

    Here is my current OnSuccess Property:

    Patch(
     Etching_Maintenance_Reports,
     Down_Machine_Details_Form.LastSubmit,
     {
     'Machine is Down': "False",
     'Parts Replaced': Parts_Replaced_ComboBox.Selected.'Item Description',
     'Part Costs': Parts_Cost_New_TextInput.Text
     }
    );

     

  • BlessedCobba Profile Picture
    459 Super User 2024 Season 1 on at

    Try This,
    Parts_Cost_New_TextInput.Text has all the output you're after, you just need to split it into the columns you are after for your output

     

    Patch(
     Etching_Maintenance_Reports,
     Down_Machine_Details_Form.LastSubmit,
     { 
     'Machine is Down': "False",
     'Parts Replaced': First(Split(Parts_Cost_New_TextInput.Text, "-")).Result, 
     'Parts Cost': Last(FirstN(Split(Parts_Cost_New_TextInput.Text, "-"),2)).Result
     }
    )

     

  • Verified answer
    WarrenBelz Profile Picture
    153,024 Most Valuable Professional on at

    Hi @Chrisguff12 ,

    You just need to split the output into the two fields - first one Parts Replaced

    With(
     {
     wCosts: 
     Concat(
     colCosts,
     'Item Description' & ", "
     )
     },
     Left(
     wCosts,
     Len(wCosts) - 2
     )
    )

    Second one - Parts Cost

    "$" & 
    Text(
     Sum(
     colCosts,
     Cost
     ),
     "[$-en]###,##0.00"
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

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 793 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 333 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard