Help with flattening dataview table

What I’m trying to do

I want to build a dataview table that automatically gathers all equations I mark as important in my notes. Notes are organized in subfolders, and the table note will be in the parent folder.

Things I have tried

To insert an important equation I use the following template:

%%
#equation
[name::some equation]
[eqn::$$2+2=5$$]
%%

And to retrieve the equations I use the following dataview code:

```dataview
TABLE WITHOUT ID name, eqn, file.link AS file
FROM #equation

The problem with this code is that equations belonging to the same note will appear in the same row of the table, in a sort of dotted list. So, I’ve tried to flatten wrt equations, so that each equation has its own row in the table:

TABLE WITHOUT ID name, eqn, file.link AS file
FROM #equation
FLATTEN eqn

The problem with this second code is that it replicates the same equations and associate it to each other name there is in the equation file. For instance, if I have a file with two equations eqn1 and eqn2 named respectively eqnName1 and eqnName2, I will get two rows for eqn1: one row with eqnName1 and one row with eqnName2. And the same goes for eqn2.

Any suggestions? :slight_smile:

Try doing FLATTEN eqn as E, and use E instead of eqn when you want to reference the unique equation.

Do however note that your current markup doesn’t connect the name and eqn together as a unit, so they might become misaligned as it’s currently written.

Hi! Thank you for the reply. I’ve tried the way you have suggested (as far as I’ve understood):

TABLE WITHOUT ID name, E, file.link AS file
FROM #equation
FLATTEN eqn AS E

But it has the same problem. If you have any suggestion on how to write the markup in a way that eqn and name are linked together I’d really appreciate it!

Usually I would recommend using a list (or task) to connect stuff together, but not sure how easy that would be to do with long equations.

However, if you search this forum we had a similar discussion suggesting just that approach.

Thank you, I will try this method!

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