Sorting Repeating Group

I have a table called SALETYPE that has 2 fileds SaletypeName and SaleTypePriority:

SaletypeName SaletypePriority
Stock 3
Wholesale 2
Retail 1

I now have another table called SALERECORD that records all sales and types
This one has fields Qty TypeofBag and SaleTypeName
so i.e

20 Blue Bag Stock
1 Red Bag Retail
15 Yellow Bag Retail
10 Green Bag Wholesale

I want to create a Repeating group showing all the sales on table SALERECORD that are sorted based on the SaleTypeName based on the priority set in table SALETYPE.

Is this possible?

Yes, but it needs a bit of turning inside out to do it !

Firstly, if you have two text fields on each table with “Stock” “Retail” in them, then you are really making life more complicated for yourself.

So set it up like this first …

image

image

So you are linking SALETYPE and SALERECORD inside bubble, not via the text. Bear in mind that you need to do this linking in the data as well, not just the field :slight_smile:

Now, the inside out bit…

In your SALERECORD repeating group, first search for SALETYPE (which you can now sort on Priority) and then use the list field you created above to pull back the list of SALERECORDS which are now in Priority order.

Looks a bit complex … but it you think about what it is doing …

Instead of …

Get a million SALERECORDS, then look up their Priority, then sort the million into Priority Order …

Bubble is doing …

Get 3 SALETYPEs and put them in order, now get a) all the 1s b) all the 2s and c) all the 3s from SALERECORD and combine them as they are already in the order you want.

Ok, great, might be daft question but Inside the SALERECORD which field of table SALETYPE do I use for “Change search field”?

  1. ListofSaleRecords
  2. Priority
  3. SaletypeName?

I presume Priority?

This topic was automatically closed after 70 days. New replies are no longer allowed.