Skip to content

Commit

Permalink
Changes by create-pull-request action (#92)
Browse files Browse the repository at this point in the history
Co-authored-by: akosbalasko <[email protected]>
Co-authored-by: Akos Balasko <[email protected]>
  • Loading branch information
3 people committed Oct 17, 2021
1 parent 8d53292 commit 5de391c
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lastPostId.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
465
482

45 changes: 45 additions & 0 deletions scripts/MBV_1634413308000.md
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 &amp; corresponding value to update a table) using Dataview in case it can be useful. I use it as my &#x2018;google search for notes&#x2019; without creating a rigid structure of tables &amp; 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 &lt;field1&gt;, &lt;field2&gt;, ....
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, &lt;value to test 1&gt;), &lt;corresponding YAML field1&gt;, choice(contains(this.QueryKey, &lt;value to test 2&gt;), &lt;corresponding YAML field2&gt;, &lt;default YAML field&gt;))</code></p>
<p>by nesting <code>choice</code> statements (equivalent to &#x2018;if statements&#x2019;) as much as required.</p>
<p>The query will therefore look like:</p>
<pre><code class="lang-auto">\```dataview
Table without id &lt;field1&gt;, &lt;field2&gt;, ....
where contains(choice(contains(this.QueryKey, &lt;value to test 1&gt;), &lt;corresponding YAML field1&gt;, choice(contains(this.QueryKey, &lt;value to test 2&gt;), &lt;corresponding YAML field2&gt;, &lt;default YAML field&gt;)), 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 &#x2018;Search Library&#x2019; &gt; launch MetaEdit for the note &gt; update values of &#x2018;QueryKey&#x2019; and/or &#x2018;QueryTerm&#x2019; &gt; Dataview table updates.</p>
<p>I hope that this can be useful!</p>

0 comments on commit 5de391c

Please sign in to comment.