When I convert an object into a string it returns in side of "{}". How do I change that?

What I’m trying to do

Using dataview I am trying to make a table where it returns all the sub-topics mentioned in a note. However, because one of them is in every note I don’t want it to return every time. So I took the ‘topics’ object, made it a string and replaced the re-occurring topic.

TABLE WITHOUT ID 
	file.link AS "Inputs about Productivity", 
	split(replace(string(extract(file, topics)),"[[Productivity & Productive Skills]] –", ""), "–") AS Sub-Topics, 
FROM "3.Inputs📥"
SORT file.name ASC

The problem is now the topics that do return in “{}” and I don’t know why?

How do your definition of the field topics look like?

It looks like

topics:: [[topic a]] – [[topic b]] – [[topic c]]

I’m not quite sure why you do all of that extract(...) stuff, when it seems to be easier to do:

split(replace(string(topics), "[[topic a]] – ", ""), " – ") as SubTopics

And in fact, it’s the extract() which introduce the braces, so use the above, and it seems like your issue is solved.

Alternative syntax

I would consider doing something like:

topics:: [[topic a]], [[topic b]], [[topic c]]

This would make topics a proper list of links, instead of just a string, which then would allow for creating the subtopics using filter like in the following column definition:

filter( topics, (f) => f != [[topic a]] ) as Subtopics

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