A nested repeating group with inputs, grouped by category

I want to create a repeating group, which displays cost categories, you have created for an order (thing).
The goal I have:

Categories are repeating group 1 - so grouping here by categories.
Elements are repeating group 2 - splitting by the orders.

When I create do a search for items which are grouped by the orders, the categories display in a proper way.
The challenge I have is when I created grouping for category, the second search doesn’t seem to work - as this second group doesn’t split the costs via orders - as they are revenues / not orders. Anybody did that kind of table? Any good experiences how to approach this?

I am storing the costs like below:

  1. Cost1 - category 1 - order 1
  2. Cost2 - category 2 - order 1
  3. Cost 3 - category 1 - order 2
  4. Cost 4 - category 2 - order 2
    So I have a single element for each cost - not that I have an aggregate that stores cost values as fields.

You mention grouping quite often, but I’m not clear whether you are using the :group by operator, or whether you are just using a repeating group which takes Categories as a datasource using a :do a search for. Which of the two is it?

I dont know the specifics of your project, but I recommend looking into skipping the nested :do a search because because it could lead to slow performance/high WUs as you are initiating many searches.
You could run the search for all orders/elements/costs/revenes (you are using all these words quite interchangeably so its hard to understand what you are doing. Please clarify a bit), and then use client side filtering inside the nested repeating group to populate it, rather than running a second search (which would be run on each cell).
This might not be the best solution for all use-cases, but it is worth checking if it would work for you. If you are working with large amounts of data, and the first search would consitently return >1000 elements, then it might not be a good solution.

1 Like

Thanks Nico.

I just want to display elements from one search as a table.
Where orders will be columns and categories will be rows.
[But that means I need to somehow display the category differently as it is not a thing but just a grouping.]
Inside the cells I want to put input fields, so you can edit selected elements.

That is why I pasted the Excel sample to present what my goal is.

No problem, we can definitely get this to work.

I’m not clear on how the table you want to display relates to your stored values.

Im clear on the first RG displaying Categories, but what is the relationship between order costs and elements? What type of editing do you want to do on the inputs?

Please share screenshots of your editor; ideallly the two RGs & the data tab.

The goal is to get in bubble Excel Pivot functionality plus here I put edit fields inside, as only one item can come from pivoting those dimensions.

I created a mock, not to share the project details, but logic is there.

Records looks like this: (to make it as simple as possible)
Cost - category - order - aggregate of more orders (to do a search for)

The thing I want is the PIVOT of category and orders, in which I can put elements.

Problem: I have following search on the category:
Search on whole repeating group:

And I don’t know what to create on the second axis - meaning split by orders.
As when I got the editor I can only address the grouping
Search for each element column ( I know the number of elements, so this one is limited to max 3)

The problem lies - that in Excel when you craete a PIVOT you actually group elements by both fields. Here I do not know how to do it.

And the problem that follows is that there can be a situation where one category has element just for 1 order - in which case there will be no item in the second row.

I have managed to come to a simple question.
When I have a repeating group (2) inside another repeating group (1) - how can I refer in my element (A) to data from repeating group (1).

RG1 > RG2 > Element A

I have found an example, but I don’t understand exactly how it is built:


PS: As I am grouping by options I am now exploring if I can link the index of a row to number of an option (additional parameter). As I am all out of OPTIONS :slight_smile:

You can refer to Groups in RG A from elements in RG B. You could put a group in RG A and add datasource+custom states, and then refer to those to get data. I hope that helps.
This only works if you are working on the same cell of RG A. Would the element in RG B and the data in RG A be in the same cell?

I suspect the problem you are facing is also related to the fact that groupings dont return the dataThings being grouped: they only return the aggregation and the grouping name.
In your scenario, RG A does not contain any Costs dataThings. It only contains groupings of costs - Which would just be category name and the aggregation you selected for the grouping.
Were you aware of this?

1 Like

Regarding the first part - yes.
RG1 will have 11 fields and RG2 will have 1-2 (maybe 3 in the future).
So if I am in field A - then I will be only editing A type fields for 2 orders.

Regarding the second part - I have seen it works this way, but thought I could address this somehow. Which for me is logical as the structure is there, so why not refer to it.
The trick is - I want to get single items as 1 can have different cost from another… and some of the may not even exist - as for ex. category A may have cost for order 1, but not for 2 and category B can have vice versa.

So I will read through what you have posted. Or maybe come back to analyzing the example I have pasted.

I dropped the input request to be inside this group as this no longer refers to the elements.

I managed to create this:

I succeeded in refering to single element in the input, but…

display is ugly as it is not a pivotal form
update of values takes ages, as there is no autobinding here

Thank you for the advice, as I learned a lot, but I have to build it differently.

PS: Actually if I cannot display it pivotaly, I no longer have a problem :slight_smile: Meaning - the problem persists but the solution is not something I actually need.