Query to Return not based on order of values

Things I have tried

Hi all,

I am trying to return notes based on some metadata. I have been using Obsidian for only about two weeks. I am using this code to return notes.

TABLE arpabet as "arpabet", arpatype as "arpatype"
FROM "words"
WHERE contains(arpatype, "FrU VoM")
sort file.ctime desc

Here is a visual if it helps:

What I’m trying to do

I would like to return notes that contain the values in any order. So for this example

"FrU VoM" or "VoM FrU"

the more simple solution: WHERE contains(arpatype, "FrU VoM") OR contains(arpatype, "VoM FrU")
There’s the reverse() function… but in strings it works like a mirror

1 Like

That makes sense. :+1:t2:

What would you do if the number of values increases? Instead of 2, we go with 3+. Would we have to just expand the logic on a case-by-case basis?

Well, the problem is: we are not talking about values (in the logic key: value) but in strings. More specifically, in substrings.
Unless you know a powerful regex (I don’t, neither the simplest one :slight_smile: ) I don’t know how to apply a filter to a substring and its reverse.

1 Like

lol – yeah, I will keep looking. :slight_smile:

I’ll use your current solution for the time being though!

but you can use this logic
WHERE contains(arpatype, "FrU") AND contains(arpatype, "VoM")

a sum of substrings… order doesn’t matter (but it does not ensure that they are together)

1 Like

That is what I was looking for!

Here is a visual for future readers.

Notice how the two words returned have all three values but in different orders. That is what I was attempting. Thanks @mnvwvnm!

1 Like

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