-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changes by create-pull-request action (#92)
Co-authored-by: akosbalasko <[email protected]> Co-authored-by: Akos Balasko <[email protected]>
- Loading branch information
1 parent
8d53292
commit 5de391c
Showing
2 changed files
with
47 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
465 | ||
482 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--- | ||
title: | ||
author: MBV (https://forum.obsidian.md/u/MBV) | ||
Publication Date: Sat Oct 16 2021 | ||
Last modification Date: Sat Oct 16 2021 | ||
--- | ||
|
||
|
||
<p>Hi all<br> | ||
I thought i would share the workflow i built for creating dynamic tables enabling me to change a search key & corresponding value to update a table) using Dataview in case it can be useful. I use it as my ‘google search for notes’ without creating a rigid structure of tables & sparing time going through a long list of notes.<br> | ||
It also enables me to remain in Preview mode and uses 3 plugins: Buttons, MetaEdit, Dataview.</p> | ||
<p>YAML frontmatter:</p> | ||
<pre><code class="lang-auto">--- | ||
QueryTerm: | ||
QueryKey: | ||
... | ||
--- | ||
</code></pre> | ||
<p>Dataview Query:</p> | ||
<pre><code class="lang-auto">\```dataview | ||
Table without id <field1>, <field2>, .... | ||
where contains(this.QueryKey, this.QueryTerm) | ||
sort file.name asc | ||
\``` | ||
</code></pre> | ||
<p>the trick here is that <code>this.QueryKey</code> will appear as a value and not as a YAML field therefore transtypage is required. In the afore-mentioned code, replace <code>this.QueryKey</code> with something like:<br> | ||
<code>choice(contains(this.QueryKey, <value to test 1>), <corresponding YAML field1>, choice(contains(this.QueryKey, <value to test 2>), <corresponding YAML field2>, <default YAML field>))</code></p> | ||
<p>by nesting <code>choice</code> statements (equivalent to ‘if statements’) as much as required.</p> | ||
<p>The query will therefore look like:</p> | ||
<pre><code class="lang-auto">\```dataview | ||
Table without id <field1>, <field2>, .... | ||
where contains(choice(contains(this.QueryKey, <value to test 1>), <corresponding YAML field1>, choice(contains(this.QueryKey, <value to test 2>), <corresponding YAML field2>, <default YAML field>)), this.QueryTerm) | ||
sort file.name asc | ||
\``` | ||
</code></pre> | ||
<p>On the same note, I have a button:</p> | ||
<pre><code class="lang-auto">\```button | ||
name Search Library | ||
type command | ||
action MetaEdit: Run MetaEdit | ||
\``` | ||
</code></pre> | ||
<p>In preview mode on the note: Button ‘Search Library’ > launch MetaEdit for the note > update values of ‘QueryKey’ and/or ‘QueryTerm’ > Dataview table updates.</p> | ||
<p>I hope that this can be useful!</p> | ||