Blueprint layout table: query structure name based on id

Hi

Maybe I haven’t found the right documentation or was able to search for the correct forum entry, but here is my question:

I have the following key-value store:

# categories.yml
fields:
  categories:
    type: structure
    fields:
      name:
        type: text
      uuid:
        type: structure-uuid
        label: UUID

(structure-uuid is a custom field generating uuids, but it should really matter I think)

I have an article blueprint, which has a category field which contains categories-ae126b32-633c-4db5-88fd-57b6e0956161 as its value

Using the layout: table I would like to do something like this:

# articles.yml
sections:
  articles:
    layout: table
    type: pages
    template: article
    columns:
      category: true
        query: site.find("categories").categories.toStructure.filterBy("uuid", page.category)
        value: "{{ item.name }}"

As of right now, the table just shows the value (eg categories-ae126b32-633c-4db5-88fd-57b6e0956161), but I would like to show the name field

Can this be done? Or is my query wrong?
The above query results in nothing (so empty string)

Thanks for any help or insight!

If you set category to true, I think the rest will be ignored, anyway, so you need to remove that.

The secondly, there is nothing like query for the columns.

You can however have use query language for the value. Guess the best option would be a custom page method that fetches the name.

 columns:
      category:
        value: "{{ page.mycustommethod(page.category)}}"
1 Like

Ahh! I see!

(setting true still does something, as I can eg say value: test value and the displayed value changes)

But thanks (as always!!) for the very quick reply - I guess I’ll use the custom page method :slight_smile: