I am looking at using the PARA method, and am tagging blocks and pages with a property value of “area”. Some areas are their own page, and some are not.
For example:
page 1
area:: history
block 1
area:: [[health]]
block 2
area:: [[mathematics]]
block 3
area:: [[health]]
etc…
I want to list all areas.
How would I write a query to return a unique list of areas (property values)?
For example, “history”, “health” and “mathematics”?
Here is an example, but it’s not a unique list of area names:
As you see here, those values with double brackets have that in the result set. Now we could totally use a replace function to get rid of them, but I propose a different solution.
In the config file there’s a portion we can use for this.
;; By default, property value separated by commas will not be treated as
;; page references. You can add properties to enable it.
;; E.g. :property/separated-by-commas #{:alias :tags}
:property/separated-by-commas #{:area}
Filling it out like this, we can then remove the double brackets for the area property while maintaining the linked references.
That is very cool . The query works for me and pulls a unique list of areas!
I see the double brackets there too. Thank you for the suggestions and proposal on how to remove!
I have a follow-up question for you that you may be able to help with…
Is there a way to keep the brackets, and make the links/list items clickable - either as a list or table view?
I defined the value of ?area from the :find as key area using :keys so that I can then use it in the :view class.
In :view I use hiccup to make a html link for the page.
Alternatively we can pull the page out, but that won’t work with your areas that are plain text, they will not show in the result set anymore.
It’s an issue with mixing two different things together.
By using the config option and no brackets we can make a clickable list at least.
To have the values in the list as links is useful. However, by leaving say value1, value2 on the same line, they form 1 link, which, if clicked on, will create a new page entitled value1, value2, which is not what I would want.
Is it possible to have value1 on its own line and value2 on its own line below?
What block and page would that be exactly?
If I remember correctly it was for a list of unique values. So if you show the block and page, then the value would no longer be unique.
If you pull the ?b instead of the value, then you will get all blocks with property topic and can make a table of it.
Otherwise I don’t know what you mean.
I got the query shown above from you. If I understand the query, it lists all the properties in use.
Some properties are used once (so far), some more.
I am not sure what you mean by unique in this context. If a property occurs on let’s say 2 pages, is it wrong to want to see which 2 pages?
It lists actually the values, not the properties themselves. At least that is the query you posted.
For the property of topic:: what values have been used.
So maybe there are 3 blocks on the topic of cats. This query only shows cats once, not three times.
Thank you. Now I understand your earlier comments as to what I was asking did not make sense.
If I want to see a list for the blocks having 1 particular topic value I have to do a simple query {{query (property topic value)}}.