Expanding rows is not working for dataset pivoted by multiple rows and 1 column over 1 calculated formula with custom data server api approach

Closed
Jun Jie asked on June 22, 2026

Issue Description

This issue happens when pivoting a dataset by 2 or more rows and 1 column over 1 aggregated measure in the classic form view. On expanding the parent item to see all child items that make up the aggregated measure value, the parent item "disappears".

Version Details

  • ngx-flexmonster: 2.9.124
  • @angular/cli: ^18.2.12
  • Node Version: 20.11.1

Attached Files Details

Refer to the attached zip file for reference materials on the issue.

  • json fm multi row col aggregation expand bug.json
    • Pivot chart flexmonster json file
  • json fm multi row col aggregation expand bug.gif
    • Example demo on the issue

Data Server API (Example used)

api1: https://localhost:8080/flexmonster/data-server/handshake

api1 req: { "type": "handshake", "version": "2.9.124" }

api1 Res: {"version":"2.9.124"}

 

api2: https://localhost:8080/flexmonster/data-server/fields

api2 req: { "index": "1712757", "type": "fields" }

api2 res: {"fields":[{"uniqueName":"filename","type":"string","caption":null,"hierarchy":null,"parent":null,"folder":null,"interval":null,"aggregations":[],"filters":null},{"uniqueName":"id","type":"number","caption":null,"hierarchy":null,"parent":null,"folder":null,"interval":null,"aggregations":[],"filters":null},{"uniqueName":"tablename","type":"string","caption":null,"hierarchy":null,"parent":null,"folder":null,"interval":null,"aggregations":[],"filters":null},{"uniqueName":"operation","type":"string","caption":null,"hierarchy":null,"parent":null,"folder":null,"interval":null,"aggregations":[],"filters":null},{"uniqueName":"command","type":"string","caption":null,"hierarchy":null,"parent":null,"folder":null,"interval":null,"aggregations":[],"filters":null},{"uniqueName":"who","type":"string","caption":null,"hierarchy":null,"parent":null,"folder":null,"interval":null,"aggregations":[],"filters":null}],"aggregations":{"any":null,"date":["count","distinctcount"],"number":["sum","count","distinctcount","average","min","max"],"string":["count","distinctcount"]},"filters":true,"sorted":false}

 

api3: https://localhost:8080/flexmonster/data-server/members

api3 req: {"index":"1712757","type":"members","field":{"uniqueName":"operation"},"page":0}

api3 res: {"members":[{"id":"execution","value":"execution"},{"id":"file ops","value":"file ops"},{"id":"test console","value":"test console"}],"sorted":true,"pageTotal":1,"page":0,"nextPageToken":null}

 

api4: https://localhost:8080/flexmonster/data-server/members

api4 req: {"index":"1712757","type":"members","field":{"uniqueName":"command"},"page":0}

api4 res: {"members":[{"id":"test","value":"test"}],"sorted":true,"pageTotal":1,"page":0,"nextPageToken":null}

 

api5: https://localhost:8080/flexmonster/data-server/members

api5 req: {"index":"1712757","type":"members","field":{"uniqueName":"filename"},"page":0}

api5 res: {"members":[{"id":"run","value":"run"},{"id":"test","value":"test"},{"id":"test 1","value":"test 1"},{"id":"test 2","value":"test 2"}],"sorted":true,"pageTotal":1,"page":0,"nextPageToken":null}

 

api6: https://localhost:8080/flexmonster/data-server/select

api6 req: {"type":"select","index":"1712757","query":{"aggs":{"by":{"rows":[{"uniqueName":"operation"}],"cols":[{"uniqueName":"filename"}]},"values":[{"func":"sum","field":{"uniqueName":"id"}}]}},"querytype":"select","page":0}

api6 res: {"fields":null,"hits":null,"aggs":[{"keys":{"filename":"test 1","operation":"file ops"},"values":{"id":{"sum":121}}},{"keys":{"filename":"test","operation":"file ops"},"values":{"id":{"sum":245}}},{"keys":{"filename":"test 1","operation":"test console"},"values":{"id":{"sum":235}}},{"keys":{"filename":"run","operation":"execution"},"values":{"id":{"sum":375}}},{"keys":{"filename":"test 2","operation":"test console"},"values":{"id":{"sum":239}}}],"pageTotal":1,"page":0,"nextPageToken":null}

 

8 answers

Public
Maksym Diachenko Maksym Diachenko Flexmonster June 23, 2026

Hello, Jun Jie!

Thank you for reporting this and sharing the details.

To investigate this further, could you please provide additional network requests and responses triggered when cells are expanded? The responses you shared were sent during initial loading, before the cells were expanded. When you expand a parent row, Flexmonster fires a separate request with the querytype parameter set as "expand".

We are looking forward to hearing from you.

Best regards,
Maksym

Public
Jun Jie June 23, 2026

Hi Maksym,

 

I don't see any additional api calls being made when expanding the parent row.

Please refer to the attached gif.

 

Thanks.

Jun Jie

Public
Jun Jie June 24, 2026

Hi Maksym,

 

After resolving the other issue "Aggregation by fields is not working for custom data server api approach" that I have raised earlier, I am now able to see the expand query api being invoked.

Please see the following for the request and response payload.

When expanding "execution" row

Request: {"type":"select","index":"1720091","query":{"aggs":{"by":{"rows":[{"uniqueName":"operation"},{"uniqueName":"command"}],"cols":[{"uniqueName":"filename"}]},"values":[{"func":"sum","field":{"uniqueName":"id"}}]},"filter":[{"field":{"uniqueName":"operation"},"include":[{"member":"execution"}]}]},"querytype":"expand","page":0}

Response: {"fields":null,"hits":null,"aggs":[{"keys":{},"values":{"id":{"sum":375}}},{"keys":{"operation":"execution"},"values":{"id":{"sum":375}}},{"keys":{"command":"test"},"values":{"id":{"sum":375}}},{"keys":{"filename":"run"},"values":{"id":{"sum":375}}},{"keys":{"filename":"run","operation":"execution","command":"test"},"values":{"id":{"sum":375}}}],"pageTotal":1,"page":0,"nextPageToken":null}

 

When expanding "file ops" row

Request: {"type":"select","index":"1720091","query":{"aggs":{"by":{"rows":[{"uniqueName":"operation"},{"uniqueName":"command"}],"cols":[{"uniqueName":"filename"}]},"values":[{"func":"sum","field":{"uniqueName":"id"}}]},"filter":[{"field":{"uniqueName":"operation"},"include":[{"member":"file ops"}]}]},"querytype":"expand","page":0}

Response: {"fields":null,"hits":null,"aggs":[{"keys":{},"values":{"id":{"sum":366}}},{"keys":{"operation":"file ops"},"values":{"id":{"sum":366}}},{"keys":{"command":"test"},"values":{"id":{"sum":366}}},{"keys":{"filename":"test 1"},"values":{"id":{"sum":121}}},{"keys":{"filename":"test"},"values":{"id":{"sum":245}}},{"keys":{"filename":"test 1","operation":"file ops","command":"test"},"values":{"id":{"sum":121}}},{"keys":{"filename":"test","operation":"file ops","command":"test"},"values":{"id":{"sum":245}}}],"pageTotal":1,"page":0,"nextPageToken":null}

 

When expanding "test console" row

Request: {"type":"select","index":"1720091","query":{"aggs":{"by":{"rows":[{"uniqueName":"operation"},{"uniqueName":"command"}],"cols":[{"uniqueName":"filename"}]},"values":[{"func":"sum","field":{"uniqueName":"id"}}]},"filter":[{"field":{"uniqueName":"operation"},"include":[{"member":"test console"}]}]},"querytype":"expand","page":0} 

Response: {"fields":null,"hits":null,"aggs":[{"keys":{},"values":{"id":{"sum":474}}},{"keys":{"operation":"test console"},"values":{"id":{"sum":474}}},{"keys":{"command":"test"},"values":{"id":{"sum":474}}},{"keys":{"filename":"test 2"},"values":{"id":{"sum":239}}},{"keys":{"filename":"test 1"},"values":{"id":{"sum":235}}},{"keys":{"filename":"test 2","operation":"test console","command":"test"},"values":{"id":{"sum":239}}},{"keys":{"filename":"test 1","operation":"test console","command":"test"},"values":{"id":{"sum":235}}}],"pageTotal":1,"page":0,"nextPageToken":null}

Public
Maksym Diachenko Maksym Diachenko Flexmonster June 24, 2026

Hello, Jun Jie!

Thank you for the reply.

We are glad to hear that adding the totals to the initial /select response helped to resolve the issue with further requests not being sent. We looked through the provided expand request/response pairs, and everything looks correct. The requests are being sent as expected, and the responses are structured properly.

Feel free to contact us if any further issues arise.

Best regards,
Maksym

Public
Jun Jie June 25, 2026

Hi Maksym,

Unfortunately, while pivoting by 3 rows and 1 measures does work, I am still not able to get pivoting by 2 rows and 1 cols with 1 measures to work. When pivoting by 2 rows and 1 cols, expanding the parent row results in blank row. I am providing the sample request and response for the pivot that does work and the pivot that does not work.

 

Attachment details

The Zip file contains a report.json file containing the pivot configuration and a .mp4 file demonstrating pivoting for 3 rows and 1 measures vs 2 rows + 1 cols with 1 measures.

 

Pivot by row [operation, command, filename] and values [Sum of id] (This is working)

1. /select when loading pivot:

request: {"type":"select","index":"1723045","query":{"aggs":{"by":{"rows":[{"uniqueName":"operation"}]},"values":[{"func":"sum","field":{"uniqueName":"id"}}]}},"querytype":"select","page":0}

response: {"fields":null,"hits":null,"aggs":[{"keys":{},"values":{"id":{"sum":1215}}},{"keys":{"operation":"file ops"},"values":{"id":{"sum":366}}},{"keys":{"operation":"test console"},"values":{"id":{"sum":474}}},{"keys":{"operation":"execution"},"values":{"id":{"sum":375}}},{"keys":{"operation":"test console"},"values":{"id":{"sum":474}}},{"keys":{"operation":"execution"},"values":{"id":{"sum":375}}},{"keys":{"operation":"file ops"},"values":{"id":{"sum":366}}}],"pageTotal":1,"page":0,"nextPageToken":null}

 

2. /select when expanding operation="execution"

request: {"type":"select","index":"1723045","query":{"aggs":{"by":{"rows":[{"uniqueName":"operation"},{"uniqueName":"command"}]},"values":[{"func":"sum","field":{"uniqueName":"id"}}]},"filter":[{"field":{"uniqueName":"operation"},"include":[{"member":"execution"}]}]},"querytype":"expand","page":0}

response: {"fields":null,"hits":null,"aggs":[{"keys":{},"values":{"id":{"sum":375}}},{"keys":{"operation":"execution"},"values":{"id":{"sum":375}}},{"keys":{"command":"test"},"values":{"id":{"sum":375}}},{"keys":{"operation":"execution","command":"test"},"values":{"id":{"sum":375}}}],"pageTotal":1,"page":0,"nextPageToken":null}

 

3. /select when expanding operation="execution", command="test"

request: {"type":"select","index":"1723045","query":{"aggs":{"by":{"rows":[{"uniqueName":"operation"},{"uniqueName":"command"},{"uniqueName":"filename"}]},"values":[{"func":"sum","field":{"uniqueName":"id"}}]},"filter":[{"field":{"uniqueName":"operation"},"include":[{"member":"execution"}]},{"field":{"uniqueName":"command"},"include":[{"member":"test"}]}]},"querytype":"expand","page":0}

response: {"fields":null,"hits":null,"aggs":[{"keys":{},"values":{"id":{"sum":375}}},{"keys":{"operation":"execution"},"values":{"id":{"sum":375}}},{"keys":{"command":"test"},"values":{"id":{"sum":375}}},{"keys":{"filename":"run"},"values":{"id":{"sum":375}}},{"keys":{"filename":"run","operation":"execution","command":"test"},"values":{"id":{"sum":375}}}],"pageTotal":1,"page":0,"nextPageToken":null}

 

Pivot by row [operation, command], col [filename]  and values [Sum of id] (This is not working)

1. /select when loading pivot:

request: {"type":"select","index":"1723045","query":{"aggs":{"by":{"rows":[{"uniqueName":"operation"}],"cols":[{"uniqueName":"filename"}]},"values":[{"func":"sum","field":{"uniqueName":"id"}}]}},"querytype":"select","page":0}

response: {"fields":null,"hits":null,"aggs":[{"keys":{},"values":{"id":{"sum":1215}}},{"keys":{"operation":"file ops"},"values":{"id":{"sum":366}}},{"keys":{"operation":"test console"},"values":{"id":{"sum":474}}},{"keys":{"operation":"execution"},"values":{"id":{"sum":375}}},{"keys":{"filename":"test 2"},"values":{"id":{"sum":239}}},{"keys":{"filename":"run"},"values":{"id":{"sum":375}}},{"keys":{"filename":"test"},"values":{"id":{"sum":245}}},{"keys":{"filename":"test 1"},"values":{"id":{"sum":356}}},{"keys":{"filename":"test","operation":"file ops"},"values":{"id":{"sum":245}}},{"keys":{"filename":"test 1","operation":"file ops"},"values":{"id":{"sum":121}}},{"keys":{"filename":"test 1","operation":"test console"},"values":{"id":{"sum":235}}},{"keys":{"filename":"run","operation":"execution"},"values":{"id":{"sum":375}}},{"keys":{"filename":"test 2","operation":"test console"},"values":{"id":{"sum":239}}}],"pageTotal":1,"page":0,"nextPageToken":null}

 

2. /select when expanding operation="execution"

request: {"type":"select","index":"1723045","query":{"aggs":{"by":{"rows":[{"uniqueName":"operation"},{"uniqueName":"command"}],"cols":[{"uniqueName":"filename"}]},"values":[{"func":"sum","field":{"uniqueName":"id"}}]},"filter":[{"field":{"uniqueName":"operation"},"include":[{"member":"execution"}]}]},"querytype":"expand","page":0}

response: {"fields":null,"hits":null,"aggs":[{"keys":{},"values":{"id":{"sum":375}}},{"keys":{"operation":"execution"},"values":{"id":{"sum":375}}},{"keys":{"command":"test"},"values":{"id":{"sum":375}}},{"keys":{"filename":"run"},"values":{"id":{"sum":375}}},{"keys":{"filename":"run","operation":"execution","command":"test"},"values":{"id":{"sum":375}}}],"pageTotal":1,"page":0,"nextPageToken":null}

 

3. /select when expanding operation="file ops"

request: {"type":"select","index":"1723045","query":{"aggs":{"by":{"rows":[{"uniqueName":"operation"},{"uniqueName":"command"}],"cols":[{"uniqueName":"filename"}]},"values":[{"func":"sum","field":{"uniqueName":"id"}}]},"filter":[{"field":{"uniqueName":"operation"},"include":[{"member":"file ops"}]}]},"querytype":"expand","page":0}

response: {"fields":null,"hits":null,"aggs":[{"keys":{},"values":{"id":{"sum":366}}},{"keys":{"operation":"file ops"},"values":{"id":{"sum":366}}},{"keys":{"command":"test"},"values":{"id":{"sum":366}}},{"keys":{"filename":"test 1"},"values":{"id":{"sum":121}}},{"keys":{"filename":"test"},"values":{"id":{"sum":245}}},{"keys":{"filename":"test","operation":"file ops","command":"test"},"values":{"id":{"sum":245}}},{"keys":{"filename":"test 1","operation":"file ops","command":"test"},"values":{"id":{"sum":121}}}],"pageTotal":1,"page":0,"nextPageToken":null}

 

4. when expanding operation="test console"

request: {"type":"select","index":"1723045","query":{"aggs":{"by":{"rows":[{"uniqueName":"operation"},{"uniqueName":"command"}],"cols":[{"uniqueName":"filename"}]},"values":[{"func":"sum","field":{"uniqueName":"id"}}]},"filter":[{"field":{"uniqueName":"operation"},"include":[{"member":"test console"}]}]},"querytype":"expand","page":0}

response: {"fields":null,"hits":null,"aggs":[{"keys":{},"values":{"id":{"sum":474}}},{"keys":{"operation":"test console"},"values":{"id":{"sum":474}}},{"keys":{"command":"test"},"values":{"id":{"sum":474}}},{"keys":{"filename":"test 2"},"values":{"id":{"sum":239}}},{"keys":{"filename":"test 1"},"values":{"id":{"sum":235}}},{"keys":{"filename":"test 2","operation":"test console","command":"test"},"values":{"id":{"sum":239}}},{"keys":{"filename":"test 1","operation":"test console","command":"test"},"values":{"id":{"sum":235}}}],"pageTotal":1,"page":0,"nextPageToken":null}

 

 

 

Public
Maksym Diachenko Maksym Diachenko Flexmonster June 26, 2026

Hello, Jun Jie!

Thank you for writing to us.

After further investigation, we identified the root cause: the expand responses are missing a subtotal entry that combines the parent row field (operation) and the child row field (command) without the column field (filename). Without it, Flexmonster can't anchor the child row under the expanded parent, causing the parent row to disappear.

The fix is to add the following entries to each response:
1. Expand "execution"

{ "keys": { "operation": "execution", "command": "test" }, "values": { "id": { "sum": 375 } } }

2. Expand "file ops"

{ "keys": { "operation": "execution", "command": "test" }, "values": { "id": { "sum": 375 } } }

3. Expand "test console"

{ "keys": { "operation": "execution", "command": "test" }, "values": { "id": { "sum": 375 } } }

Please let us know if this worked for you.

Best regards,
Maksym

Public
Jun Jie July 2, 2026

Thanks Maksym. The solution provided is working.

Public
Maksym Diachenko Maksym Diachenko Flexmonster July 2, 2026

Hello, Jun Jie!

Thank you for your feedback.
We are glad that our solution worked for you.
Feel free to contact us if more questions arise.

Best regards,
Maksym

This question is now closed