Questions about Embend Queries

This post was last updated for 216 days ago, and the information may already be changed

First of all, I want to extend a heartfelt thank you to everyone involved with Siyuan. It's a fantastic app with a wealth of features.❤️

While I'm not a programmer, and thus unable to contribute to extending its functionality, I'd be more than happy to assist in other ways, such as improving the English User-Guide. I could help clarify the instructions and add more how-to examples. Just let me know if that would be useful. But before that, I have some questions that I've been struggling with for weeks. I would greatly appreciate it if someone could provide examples and explanations for what I'm trying to achieve. Thanks in advance for your help!🙏

How to Query Attributes and Embed the Query on a Page

  • The example provided illustrates how to query a custom attribute with a numeric value:
    • FROM blocks
      WHERE id IN (
          SELECT block_id
          FROM attributes AS a
          WHERE (a.name ='custom-progress' AND a.value = '30')
             OR (a.name ='custom-priority' AND a.value = '2')
          GROUP BY block_id
          HAVING count(block_id) = 2
      );
      
    • However, when attempting to query non-numeric custom attributes or built-in attributes such as 'bookmark' or 'name', the query fails.
      • How can I successfully embed queries for both preset and custom attributes, as well as database attributes with non-numerical values?
  • I aim to replicate the functionality of the backlink panel by embedding it directly within my document.

How to Display Database Attributes

  • It is feasible to embed a document's attributes within a page using a template, as demonstrated here: siyuan-template-misc
    • However, I'm interested in also displaying custom attributes and, importantly, database attributes. How can this be accomplished?

    Related articles

    Welcome to here!

    Here we can learn from each other how to use SiYuan, give feedback and suggestions, and build SiYuan together.

    Signup About
    Please input reply content ...
    • ciwoyipang 1 1 Comment
      1. Like this
      select * from blocks where id in (select block_id from attributes where name = 'custom-function' and value = 'value')
      
      
      1. Three ways
      • image.png
        • Then / Template
        • image.png
      • Tomato plugin
        • image.png
        • image.png
      • enhance plugin
        • image.png
      1. image.png
      Thank you for your answer! I will take a look at it. Meanwhile, I can say I have already tried the Attribute Panel Plugin, but it does not display all database attributes, like for example all attributes wich are also a relation to another database are not shown.
      n12k0