Dataview Query: How to prevent different records from appearing in a single line of a table

I have in my daily notes some tags that I use as a basis for Dataview Queries.
The scheme I follow is as follows:

Subject:: Subject matter
Content:: Development of the subject.
Link:: URL of related data on the Internet.

And the Query I follow the following format:

TABLE Subject, Content, Link FROM #Tag

Which gives me as a result a table in which the data record consists of one line for each daily note file.

The problem arises when I need to include multiple subjects, as follows:

(Group A:)
Subject:: Subject matter
Content:: Development of the subject.
Link:: URL of related data on the Internet.

(Group B:)
Subject:: Subject matter
Content:: Development of the subject.
Link:: URL of related data on the Internet.

(Group C:)
Subject:: Subject matter
Content:: Development of the subject.
Link:: URL of related data on the Internet.

If I use the same query format the result is that all the above groups appear in the table joined in one line.

How can I get each of the above groups to appear on separate lines in the table.

To clarify your output, please give us a screenshot or similar.
Why? Mainly to clarify what signifies “joined” (if something similar to join() function; if a theme issue; if a misreading how metadata works).
Just an extra point: all your metadata works at page level, not in direct relation between them. I.e., in your second example (multiple groups), when multiple subjects, no way to directly relate subject in group B with content in group B. Your field “Subject” has multiple values (subjectA, subjectB, subjectC), “Content” has others (contentA, contentB, contentC), … They don’t work in transversal groups (between fields).

Thank you very much for your prompt response.

I used the word joined to indicate that all the records are on one line instead of on separate lines.

I have attached three screenshots. In the first one there is only one record on a single line. In the second one there are four records, also on a single line, the one corresponding to the name of the daily note file, although it does not present a problem of visualization and understanding of its content. But the third screenshot shows what happens when one of the fields of one of the records has more text.

From your explanation I understand that there may not be a solution to this problem. However, I would like to know what you would do so that the information, such as the one in the third screenshot, is displayed in an understandable way.

Thank you again.

Well, there are two kind of issues: 1) related with the previous point (multiple values in each field and no relation between them); 2) how results are presented in your table.

  1. About first point, there’s no solution.

  2. About visualisation… some issues are related with the way how columns try to adapt width to the content. But your theme seems not optimised for tables. If you use the default theme you have better results?
    To avoid so many discrepancies in columns width it’s necessary some CSS code. Do you know how to create css snippets?

I thank you for your response. I comment on each point:

  1. As there is no solution to the raised, I am looking for alternatives: for this I have thought to have short texts in each field, consisting of links to a subtitle whose content can be seen, for example, ![[2021-12-31#Annex-1]], but unfortunately, in the display mode of the table, the content is not seen and the link does not work. Is there any way to achieve this?

  2. I tried the default theme and some other themes, but the only change I achieve with some of them is that every text in a table field appears bulleted and in another case that the vertical alignment becomes top instead of centered. But the width of the columns is not modified. As I don’t know about CSS, I enabled in the Appearance section of Obsidian Preferences the application of CSS snippets and placed in the Snippets folder a .css file that I downloaded from this same Forum, which contains different styles of tables, but it does not change the style of the tabs nor in the example files that I also downloaded. I don’t know if I have to insert some specific fragment in the style file, to modify the width of the columns and the vertical alignment of the tables.

I don’t want to bother you any more, but any suggestions would be welcome.

May I take this opportunity to wish you a Happy New Year.

By points:

  1. You can’t embed elements via dataview (only images via url). It’s a limitation forced by Obsidian.

  2. About “style” you need to have one base (theme?) and add some css snippets if necessary. Many snippets with the same target (e.g.: tables) can create conflicts and become very difficult to deal with.
    If you want to make some changes you need to learn some basic css (I’m also a newbie) because if you add a css code found somewhere you can create conflicts with other previous definitions. You need to know a minimum about what you are adding.
    Considering your description:

  • In dataview tables, when you see “bullets” means that you obtain as result a “list”. With your example in your first post (one value per field) you got a table without bullets, because in each field you don’t have multiple values. With the example with groups you got bullets because in each field you have a list. In my case I use this code to hide “bullets” in all dataview tables:
ul.dataview-ul {
  • About a snippet you found… If you found a snippet with different styles of tables, how obsidian choose the style you want to use? A, B, C, …? You need to read the source where you found it and confirm any reference to “cssclasses”. What this means? It’s related with yaml frontmatter. In the first line of your note you need to add a yaml frontmatter, create the field cssclass: xxxxx and write the chosen class to apply to your note (all note, not a part of). Let’s say that you want to choose (for all your file) a table defined in your snippet with the class “table-blue”. Then you nedd to add in frontmatter this:
cssclass: table-blue
  • About other ways to control the style of your dataview table, you can define a small size for output text, a minimum or a maximum for column width, etc. For example (defining text size for rows and the minimum width for columns):
.markdown-preview-view .table-view-table td {
  font-size: 12px;
  min-width: 150px;
1 Like

Thank you very much. Your recommendations have been very helpful to me in understanding Obsidian and Dataview and looking for the best way to work with them. I refer to the points in your last message below:

  1. OK, I will not try anything in this regard.

  2. The .css file I included in Snippets came with instructions, including activating snippets in Obsidian and placing classes in the YAML area. It also came with example .md files. All of this I applied faithfully, however it did not work. I conclude that there is some incompatibility. When I learn CSS I will surely find out.

  3. I find it very useful to set the text size, and the minimum and maximum column width, so I will apply it.

  4. Considering the existing limitations to do what I originally wanted to do, your explanations have led me to simplify the tables by minimizing the number of fields, which, together with the application of your recommendation from the previous point, will make Dataview queries much more manageable.

Once again I thank you for all your help.

Just a final point.
Be aware about obsidian updates (with the new live preview). Some codes are changed and your snippets need to be adapted.
For now I don’t use the new feature, so I don’t know what changes will be necessary. But expressions as .markdown-preview-view maybe have a new designation.

Thank you very much. This may cause compatibility issues, since I already have the new Obsidian preview enabled. Good of you to make me aware of this.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.