Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Results change depending on what notes have been selected #176

Open
the-mixx opened this issue May 2, 2021 · 13 comments
Open

Bug: Results change depending on what notes have been selected #176

the-mixx opened this issue May 2, 2021 · 13 comments

Comments

@the-mixx
Copy link

@the-mixx the-mixx commented May 2, 2021

I just installed dataview for the first time yesterday and I seem to have come across a bug and I thought I’d see if anyone else is having the same issue here - or if I’m doing something wrong.

I’m trying to create a list of tasks within each of my project files where the list only shows tasks associated with the particular project in question.

My metadata in the individual tasks files is as follows:

project:: [[P - Sample project]]
status:: 03 later action

and the query in each project:

TABLE status
WHERE project = this.file.link
SORT status desc

Now this works, but in a very strange way as the results shown change dependent on what files have been selected previously. The video attached shows the behavior:

720.mov
@ebullient
Copy link

@ebullient ebullient commented May 4, 2021

I wonder what would happen if you searched for the literal string [[P .. ]] instead of the expanded link? Depending on whether or not your links are relative or absolute, the resolved link might not have the value you think it might (I use markdown rather than wiki links, and I use relative paths, so I personally wouldn't specify the project as a queryable link at all, but would instead just specify it as a string or tag.. but that's me)

@the-mixx
Copy link
Author

@the-mixx the-mixx commented May 4, 2021

Hi @ebullient by using the literal string do you mean replacing the this.file.link in the query with the string of the project file name instead? If so, my main issue with that is if I rename a project then the query would need to be manually updated where as if I use the links everywhere then they would be updatead automatically. Also I would need to fill this in manually for each and every project that I create

Regarding absolute vs relative, in this test vault I have no sub-folders so I'm guessing that that wouldn't change things?

So do you have a tag for every project?

Ps. if not 100% clear I'm trying our using a .md file as both a task and project.

@ebullient
Copy link

@ebullient ebullient commented May 4, 2021

Y. I tend to use tags rather than projects ... #project/A vs #project/B
tagWrangler can help you rename all of your tags in one go... such that the file/link name doesn't matter. ;)

TABLE status from #project/A
SORT status desc

@the-mixx
Copy link
Author

@the-mixx the-mixx commented May 4, 2021

tagWrangler can help you rename all of your tags in one go... such that the file/link name doesn't matter. ;)

Could you please explain how that works? I'm not using textwrangler but keyboard maestro, but can imagine the same working there too.

I think my main concern with the tagging approach is the disconnect between the file name of a project and it's tag. So for example:

Within the file Project A.md

project:: #project/A
status:: 03 later action

@ebullient
Copy link

@ebullient ebullient commented May 4, 2021

we're off-topic a little, and it is definitely an orthogonal concern.
TagWrangler is another plugin: https://github.com/pjeby/tag-wrangler
You would add tags in metadata separately.. either by just typing #project/A any old place, or in the frontmatter as

---
tags: [ project/A ]
---

Dataview queries know how to treat tags as a "from". In essence, you would stop caring about the filename with this approach. So it may not work for you. Just proposing an alternative in case it is helpful.

I guess I don't trust the stability of the value associated with [[link]] because Obsidian is so flexible in how it finds/matches files for wikilinks.

@the-mixx
Copy link
Author

@the-mixx the-mixx commented May 4, 2021

thanks for the suggestions and links - yeah I'm not 100% confident with it at the moment for my tasks.
Would really like to know @blacksmithgu's thoughts and if this is a known issue or not

@blacksmithgu
Copy link
Owner

@blacksmithgu blacksmithgu commented May 7, 2021

This seems like an index issue (where dataview is not picking up files for a while, and then suddenly does). Can you reproduce it on the latest obsidian/dataview release?

@the-mixx
Copy link
Author

@the-mixx the-mixx commented May 9, 2021

yup still the same issue on the latest versions

@ebullient
Copy link

@ebullient ebullient commented May 10, 2021

@blacksmithgu and @the-mixx, I'm sorry, I mentioned all of the above before I'd gone and read all of the details re: the new functions. @blacksmithgu .. is it possible to clarify what the link value is when used in a where clause like that? (is it some representation of the file? Is it a string match on the link string? (would it match relative markdown links to the same file?)

Would that query work differently using "links to .. " instead of " = " ?

@the-mixx
Copy link
Author

@the-mixx the-mixx commented May 10, 2021

@ebullient - no worries.

Would that query work differently using "links to .. " instead of " = " ?

I'm not super familiar with the query language, how would you structure such a query?

I tried the following:

TABLE status as Status
FROM [[P - Sample project]]
SORT status desc

My issue with my example above is that you have to "manually" have to enter the file name in the FROM field. I couldn't figure out how to make it work with something along the lines of FROM this.file.link.

All that being said, it does seem to be a lot more stable than my original

@the-mixx
Copy link
Author

@the-mixx the-mixx commented May 10, 2021

I just tried this version ...

TABLE status as Status
FROM ""
WHERE contains(file.outlinks, this.file.link)
SORT status desc

... and this is displaying the same behavior as my original post. So as you hinted I think the issue is with this.file.link as the following 2x versions work as expected:

WHERE contains(file.outlinks, [[P - Sample project]])
WHERE project = [[P - Sample project]]

@the-mixx
Copy link
Author

@the-mixx the-mixx commented May 22, 2021

Is there any update to this one?

@blacksmithgu
Copy link
Owner

@blacksmithgu blacksmithgu commented Sep 9, 2021

There have been a few substantial index improvements in the months since this was reported - is this still reproducible?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants