Open myka280 opened 4 years ago
In the UI, we recently added the ability to reorder the columns in a table view: https://github.com/influxdata/influxdb/pull/15944
Added @nathanielc to comment on the Flux function for column ordering.
Is there any progress on this?
There is a hack for this - do a map to a series of numbered columns which will keep their order, then rename them:
|> map(fn: (r) => ({ _time: r._time, "1": r.first, "2": r.second, "3": r.third, "4": r.fourth})) |> rename(columns: { "1": "First", "2": "Second", "3": "Third", "4": "Fourth" })
Works well for me doing stacked bars in Grafana; typically I also start with a pivot to get the columns from fields.
I also want this!
Edit: Can't you just go the Cell > Configure > and on the Table select Customize and under Column Settings just rearrange the Table Columns? Which I just figured out.
Yeah. I need this too. I can't use anything done outside the database query, as the column names are not constant.
Consider column names being numbers generated from data (via pivot). The column names will then depend on the data. Some columns are staying constant as well. So my column names are A, B, C, D, E, 567, 568, 569.
The number of columns with numbered names vary, sometimes there's only one, sometimes there's 10. And I want to order them as A, C, 567, 568, 569 (as many numbered columns as there is), B, E, D.
Even the map and rename is not working here...
I need this as well. For now i'm using @pseudocoder 's hack, but I would prefer to use a real function.
@pseudocoder 's solution worked perfectly for the time being. Thanks!!!!!
I tried this one in my application to get data from my influxdb2.
|> map(fn: (r) => ({ _time: r._time, "1": r.first, "2": r.second, "3": r.third, "4": r.fourth})) |> rename(columns: { "1": "First", "2": "Second", "3": "Third", "4": "Fourth" })
I use these statements in the query with "|> schema.fieldsAsCols()"
It seems that the rearrange does not work here (12 different columns). The Columns seem to be ordered randomly and not alphabetically? With a Table with 2 columns it works fine. But maybe its just a coincidence because there are not as many cases as in the first scenario.
I also want this!
Edit: Can't you just go the Cell > Configure > and on the Table select Customize and under Column Settings just rearrange the Table Columns? Which I just figured out.
Good spot!!!!
This one would be much appreciated. Grafana logs panel after pivot is useless with random column ordering
Proposal: Need a function to order columns manually.
Current behavior: Table columns are received in a specific order and cannot be changed
Desired behavior: InfluxDB 2.0 result table columns could respect function keep() column order and return results columns in that order
Alternatives considered: Alternatevy there could be specific column order (priority) function.
Use case: GUI respects columns order received from InfluxDB?