How to show two tables in a note with one dv.view?

I have a template with two code blocks to show two tables:

dv.view("/Scripts/script_1")
dv.view("/Scripts/script_2")

The script_1.js and script_2.js contain one dv.execute querying one table each:

dv.execute(`

TABLE …
WHERE …

`);

I create notes and apply the template. The notes do show two tables.

But when I change the template and, for example, add the third table to show, I have to manually add the third table code to all existing notes the template was applied to.

How can I make a note display two or more tables by using only one dv.view?

I tried the following but without success.

Try 1

script_1.js (without script_2.js):

dv.execute(`

TABLE …
WHERE …

); dv.execute(

TABLE …
WHERE …

`);

Try 2

In addition to script_1.js and script_2.js, I create the third script_3.js:

dv.view(“/Scripts/script_1”);
dv.view(“/Scripts/script_2”);

And in the template:

dv.view("/Scripts/script_3")

Both methods show only the first table.

Is it possible to do what I want?

Whenever a template is applied, it is applied and existing notes based on that template originally won’t pick up any changes made to the template.

This leaves you with some other options. Either you make every note use a generic dv.view() function which you then update with new extension, or you leave some kind of versioning tag when inserting templates which would leave you a hook to reconnect to past insertions.

In some cases you could also let the generic template embed a document which holds all of your table insertions, and then change this embedded document when you need to.

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