# Dataview table exists since field error

**URL:** <https://forum.obsidian.md/t/dataview-table-exists-since-field-error/61443>\
**Category:** Help\
**Tags:** dataview\
**Created:** [June 12, 2023, 8:57am UTC](https://forum.obsidian.md/t/dataview-table-exists-since-field-error/61443 "2023-06-12T08:57:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![freddiecaspian](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/f/47e85d/32.png) [@freddiecaspian](https://forum.obsidian.md/u/freddiecaspian)\
**Post date:** [June 12, 2023, 8:57am UTC](https://forum.obsidian.md/t/dataview-table-exists-since-field-error/61443/1 "2023-06-12T08:57:41Z")

</div>

### What I’m trying to do

I have created an exists since field on my notes

existsSince::`= (date(today) - date(this.file.cday)).days`

This is helpful as I can see the number of days it has been since a note has been created

I want to pull through this field information into a dataview table - currently it looks like

```dataview
TABLE WITHOUT ID
link(file.path, string(description)) AS "Task", dateformat(file.ctime, " HH:mm") AS "Time Created" , existsSince

FROM #task AND -"3. Templates"

WHERE 

file.cday = this.file.cday OR file.cday = date(yesterday)

SORT Priority ASC

```

So basically I only want to see the notes from today or yesterday - however, when for some unknown reason even though the existsSince field works correctly e.g it says ‘1’ if it has been one day since it has been made - it still displays a ‘0’ on the table view…

Any help much appreciated!

### Things I have tried

asked the forum

---

<div class="post-metadata">

**Author:** ![freddiecaspian](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/f/47e85d/32.png) [@freddiecaspian](https://forum.obsidian.md/u/freddiecaspian)\
**Post date:** [June 12, 2023, 8:58am UTC](https://forum.obsidian.md/t/dataview-table-exists-since-field-error/61443/2 "2023-06-12T08:58:39Z")

</div>

![Screenshot 2023-06-09 at 10.15.28](https://forum.obsidian.md/uploads/default/original/3X/f/1/f10c8b55a440ad5af002e79bd6b006b622c8f2d0.png)  
 ![Screenshot 2023-06-09 at 10.15.31](https://forum.obsidian.md/uploads/default/original/3X/7/3/73573418b36b21f4c65c217b1dfea5e496aa1cfc.png)

---

<div class="post-metadata">

**Author:** ![holroy](https://forum.obsidian.md/user_avatar/forum.obsidian.md/holroy/32/77699_2.png) [@holroy](https://forum.obsidian.md/u/holroy)\
**Post date:** [June 12, 2023, 10:28am UTC](https://forum.obsidian.md/t/dataview-table-exists-since-field-error/61443/3 "2023-06-12T10:28:13Z")

</div>

> [@freddiecaspian](#):
>
> I have created an exists since field on my notes
> 
> existsSince::`= (date(today) - date(this.file.cday)).days`

Here you are storing the _query itself_, and not the result of the query. So when referring to this field elsewhere the query can be/ is executed in that context. In most cases this yields the wrong result.

You need to repeat the calculation from above into the other query in order to correctly see the age of the task.

Check the difference (or rather the resemblance) of the following (when going to reading view) :

```auto
aField:: 42
aQuery:: `= (date(today) - this.file.cday).days`

Value of aField: `$= dv.paragraph("~~~\n" +dv.current().aField + "\n~~~\n")`
Value of aQuery: `$= dv.paragraph("~~~\n" +dv.current().aQuery + "\n~~~\n")`

```

---

<div class="post-metadata">

**Author:** ![freddiecaspian](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/f/47e85d/32.png) [@freddiecaspian](https://forum.obsidian.md/u/freddiecaspian)\
**Post date:** [June 12, 2023, 2:34pm UTC](https://forum.obsidian.md/t/dataview-table-exists-since-field-error/61443/4 "2023-06-12T14:34:50Z")

</div>

Thank for quick response! - so do I put the text you shared on the specific note?

aField::

aQuery:: `= (date(today) - date(this.file.cday)).days`

Value of aQuery: `$= dv.paragraph("~~~\n" +dv.current().aQuery + "\n~~~\n")`

Value of aField: `$= dv.paragraph("~~~\n" +dv.current().aField + "\n~~~\n")`

* * *

And then leave this original one I shared as is?

TABLE WITHOUT ID  
link(file.path, string(description)) AS “Task”, dateformat(file.ctime, " HH:mm") AS “Time Created” , existsSince

FROM #task AND -“3. Templates”

WHERE

file.cday = this.file.cday OR file.cday = date(yesterday)

SORT Priority ASC

---

<div class="post-metadata">

**Author:** ![holroy](https://forum.obsidian.md/user_avatar/forum.obsidian.md/holroy/32/77699_2.png) [@holroy](https://forum.obsidian.md/u/holroy)\
**Post date:** [June 12, 2023, 5:43pm UTC](https://forum.obsidian.md/t/dataview-table-exists-since-field-error/61443/5 "2023-06-12T17:43:06Z")

</div>

The code example I provided was to showcase how your definition actually works to store the _query itself_, and not the _result of the query_. It could be inserted (and/or removed) whereever you want it.

In the end of the day you need to modify your query to do the calculation of the days it has existed within that query. It can’t be precalculated, and reused in another query.

---

<div class="post-metadata">

**Author:** ![system](https://forum.obsidian.md/uploads/default/original/3X/b/e/bec35fbd23ab28909bb6bfe62cb32eb82dd34019.png) [@system](https://forum.obsidian.md/u/system)\
**Post date:** [September 10, 2023, 5:43pm UTC](https://forum.obsidian.md/t/dataview-table-exists-since-field-error/61443/6 "2023-09-10T17:43:56Z")

</div>

Closed on September 10, 2023, 5:43pm UTC

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