Hello. Perhaps there is no such solution, but it’s worth a try — you need to come up with an algorithm (if at all possible) for such a task:

There are some abstract elements with properties. Each element has a string property that I can change. A number of such elements are used for display in the table (for the question I will use excel). The table has filters and groupings. Filters lead to the fact that some elements are not displayed at all in the table (they must be somehow weeded out), and the groupings lead to “collapse” - i.e. A single row in a table can contain several elements, grouped by some property. You cannot change the settings for filtering and grouping. You need to get the elements in the sequence in which they are displayed in the table. In this case, it is possible to change only one property of the element (which does not affect filtering and grouping).

Describing words is useless, so let's give an example. We have, let's say 5 elements. These 5 elements have some numerical property by which they are grouped. If there is no value in this property, then it is not displayed in the table. Let me remind you that I can not know what this property is and can not check it.

var element1 = new {Integer = 100}; var element2 = new {Integer = 200}; var element3 = new {Integer = 200}; var element4 = new {Integer = 0}; var element5 = new {Integer = 300}; 

In the table it will look like this (element4 is filtered and does not fit into the table):

Table 1

From the table I can immediately find out that the final result (and this will be a collection of lists) will have 3 positions.

If I add different values ​​to some text field of these elements (for example, just a number in order), I can get this option:

Table 2

In the second line, the "String field" cell is empty, since the elements will have a different text field value.

Analyzing the table after this step, I can already get all the "single" elements: element1 gets into the first list of the resulting collection, element5 gets into the 3 list of the resulting collection. At the same time, I know that the 1st and 3rd row of the table I no longer need to check.

And here on this place my ideas ended. Those. Now I can: 1. Find out how many finite lists should get 2. Find and select all "single" (not grouped elements) 3. Remember which lines had "single" elements so that these lines no longer check

Now I need to find the grouped elements taking into account elements that do not fall into the table at all. The most important condition is that in the "String field" column the value is displayed only when it coincides with all elements of this row.

At first I thought to do this: take one of the remaining elements, write him some unique value. Then take the next one and write the same value to it. After this step, check the table. If this value appears in the cell, then these two elements refer to the string. If it doesn’t appear, take the next element, add a value to it and check the table again. The problem is that in this way I can never find the necessary groupings, because at some step I will add an element that should not be in the current group ...

In general - is it possible to come up with an algorithm? I hope I described it in some detail.

  • Usually, the data before grouping is sorted by the columns that are grouped. After that, aggregation functions are applied to each of the groups. - MaxU am
  • @MaxU sorting, grouping and filtering are done by the application for which I am writing an addition. And there is no possibility to process them (insufficient API) - Alexander Pekshev

0