How to combine identical items into one on Or...

How to combine identical items into one on Order Capture sample app?

I am testing the Order Capture app to create an app but would like to ask if anyone has any tricks or ideas on how to combine similar Order Detail items together into one?

An example would be I have in one order 2 Order Details for apples, one 4 Qty and one 3 Qty. It would be nice to be able to auto-combine them into one order detail or just a total qty of 7 apples.

Thank you for any help with this.

If you group by “Repeat Items Price” column ,you will get grouping by price as in the attached image below

Thank you so much for your time with working on this. What you came up with will be very helpful. I

wonder if an action can create another order detail with that product but combined with and delete the duplicates?

Hi @Jason_Spicer,Thankyoufor your updates. On creating an “aggregate” record and deleting individual records, I am unsure at this moment how this can be feasible. If something strikes me, I shall definitely let you know.

AppSheet community is very helpful and I am sure someone else will guide in this new requirement.

Hi @Jason_Spicer,

I found the requirement given by you close to practical needs a user will have when creating new orders, and hence tried to work on it. Hope this helps. Apologies for a long post below.

You may wish to try the following after copying the sample App “Order Capture”

available on the AppSheet website.

In the Order Details table ,please add following 3 virtual columns

  1. [OrderProduct]Type Text. This column basically concatenates the Order ID and Product ID as this is a unique combination for repeating a product within the same order (ID)

The App formula for this column [ProductOrder] is =CONCATENATE([Product ID],[Order ID]) --------------------------------------------------------------------------------- 2) [Repeat Items Price} Type Price. This column adds up prices whenever the combination of Order ID and Product ID repeats

Please include show_if constraint for this column as =COUNT(SELECT(Order Details[OrderProduct],[OrderProduct]=[_THISROW].[OrderProduct]))>1

Please include

App formula for this column as

=SUM(SELECT(Order Details[Total],[OrderProduct]=[_THISROW].[OrderProduct])) -------------------------------------------------------------------- 3) [Repeat Items Quantity] Type number. This column adds up quantities whenever the combination of Order ID and Product ID repeats

Please include Show_If constraint as

=COUNT(SELECT(Order Details[OrderProduct],[OrderProduct]=[_THISROW].[OrderProduct]))>1

Please include App formula as

=SUM(SELECT(Order Details[Quantity],[OrderProduct]=[_THISROW].[OrderProduct])) ------------------------------------------------------------------------- 4) In the UX-> Views , go to System views. Under Order Details Table , go to Order Details_Inline view 'Please include “Repeat Items Quantity” column under group by option ---------------------------------------------------------------------------------- The above modifications will help you to see the repeated products by quantity under the same Order ID. Please refer to the attached image.

Hope this helps. May be there is a more efficient way but this one can probably help in triggering thought process in that direction.

@Suvrutt_Gurjar Hi, just reading through this post and I am trying to do something similar. I cannot seem to view the ‘attached images’ is there anyway these can be posted again to better understand the scenario?

@Sarah_Keown,

The above post thread was on Google+ when AppSheet community was on that platform. I am sorry that I do not have those attached images. You may wish to start a new post thread in the community for your current requirement. The always helpful AppSheet experts and community members will surely give a solution. I too will be glad to participate, if I have any solution.

1 Like

Thanks very much! I got things sorted anyway, your post was helpful :slight_smile:

1 Like