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 report contains field not behaving correctly depending on the data in inline field #2227

Open
blu3knight opened this issue Feb 8, 2024 · 1 comment
Labels
bug Something isn't working.

Comments

@blu3knight
Copy link

blu3knight commented Feb 8, 2024

What happened?

There are two Examples:
Example 1 the data field contains a singular item.
example mydata:: [[item1]]

In the dataview search if you do where contains(mydata, [[item1]]) the data comes up correctly in the table

Example 2 the data field contains more then 1 item.
example mydata:: [[item1]] | [[item2]]

In the dataview search if you use the same contains as above where contains(mydata, [[item1]]), nothing comes up.
If you use where contains(mydata, "[[item1]]") then it comes up correctly.

But if I use the same quotes in a singular item in Example 1 nothing comes up, unless I add something else on the line any other character makes it come up. This defeats the purpose of conformity if you need to identify if there is a singular item in the object and then have to modify the query accordingly

If you are using the boolean logic contains should not care how many items are in the field and should pull up the data on a match.

Recommendation pick one or the other, but make it work in a true boolean fashion searching for the item in the field (contain) vs =

DQL

No response

JS

No response

Dataview Version

0.5.64

Obsidian Version

1.5.3

OS

Windows

@blu3knight blu3knight added the bug Something isn't working. label Feb 8, 2024
@holroy
Copy link
Contributor

holroy commented Feb 16, 2024

You can counter this difference in behaviour related to a field having a single value or is a list of value by doing flat(list( yourFieldName ). This will ensure that it's always a list, and you can use the list tools to do your checks. If I get around to it soon, I'll hopefully add a zip(fieldName) which would do the same (plus some other new functionality to join various fields together into a new array, but until then you can use the flat(list( ... )) trick to ensure you've got a consistent way to treat your fields.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working.
Projects
None yet
Development

No branches or pull requests

2 participants