Specify column order in query table view

Hello :slight_smile:

Is there a way to specify the order of columns in the query table view?

Let’s say I have a “book” tag and each “book” has many (more than 10) properties. When I view the query, I see all the blocks with the “book” tag but the properties are in a different order than I prefer. I’d like to create different queries where I can order the columns. Is that possible?

example

#book
book-title:: 
author::
series::
series-order::
year::
genre::
status:: 
rating::

Current query and table view

#+BEGIN_QUERY
{:title "Books"
 :query [:find (pull ?b [*])
         :where
         [?p :block/name "book"]
         [?b :block/refs ?p]]}
#+END_QUERY

| book-title | author |  year | genre |  status | series-order | series| rating |

I understand I can use the “set properties” to disable some columns but I can’t reorder them on that screen. Is there was a way of specifying column order in the query?

desired query views

| book-title | author | series | series-order | year | genre | status | rating |

| genre | year | author | series | book-title |

You can re-order them in the table. What I do is un-select all properties, then re-select the properties I want in the order I want them to appear in the table.

4 Likes

You can also edit the hidden property query-properties:: of the query block by opening the markdown file in an external editor.

e.g.

query-properties:: [:book-title :author :series]

will make the query result table show those three columns in that order.

The method @AgedLace suggested will result in LogSeq writing the query-properties:: values in the order they are added, which is why that works as well.

3 Likes

Thanks for replying! That’s super useful.

2 Likes