obsidian-dataloom icon indicating copy to clipboard operation
obsidian-dataloom copied to clipboard

Use tables as templates

Open omerdn1 opened this issue 2 years ago • 2 comments

Problem

As far as I'm aware, there's currently no option to 'duplicate' a table on file creation/template insertion.

Example of a workflow that this feature lack is prohibiting: I have a 'work session' template that I use for my individual work sessions. I have a work session template that has 2 tables in it - one for planning and one for review of the work session. The expected behavior is that for each work session file I create, new tables should be created from both of the 'original' planning and review tables.

Solution

It would be very useful to have the ability to use tables as templates, or any other viable way of having decoupled data from the original table to an instantiation of it

Additional details

No response

omerdn1 avatar Jun 09 '23 12:06 omerdn1

@omerdn1 Thanks for the feature request. A table is a just a file. You can duplicate the file just like any other markdown file in Obsidian. The data will be decoupled from the original data. Have you tried this?

decaf-dev avatar Jun 12 '23 19:06 decaf-dev

To anyone wondering, I solved this issue for my particular use case using templater:

### Plan
<%*
function getWorkPlanTFile() {
    const workPlanTemplate = this.app.vault.getFiles().find((file) => file && file.path === 'Templates/Work/t-work-plan.table');
    return workPlanTemplate;
}
%>
<%* await this.app.vault.copy(getWorkPlanTFile(), tp.file.path(true) + ".plan.table") %>
![[<% tp.file.title + '.md.plan.table' %>]]
### Review
<%*
function getWorkReviewTFile() {
    const workReviewTemplate = this.app.vault.getFiles().find((file) => file && file.path === 'Templates/Work/t-work-review.table');
    return workReviewTemplate;
}
%>
<%* await this.app.vault.copy(getWorkReviewTFile(), tp.file.path(true) + ".review.table") %>
![[<% tp.file.title + '.md.review.table' %>]]

I understand that each table is its own file, but it would still be nice to achieve something similar form within this plugin. Anyways, feel free to close this :)

omerdn1 avatar Jun 14 '23 15:06 omerdn1