INTERACT FORUM

More => Old Versions => Media Center 14 (Development Ended) => Topic started by: Tolga on November 22, 2009, 03:39:50 pm

Title: Support for database expressions AND, OR, NOT
Post by: Tolga on November 22, 2009, 03:39:50 pm
Is there really not support for database expression? I would expect that would be easy to add and very useful for many applications.

I read
http://wiki.jrmediacenter.com/index.php/Database_Expressions_AND_OR_And_XOR
and I understand that all of these expressions can be in principle converted to IF statements, however,
in practice this makes it very difficult to write complicated expressions.

In particular, I started writing a single field that shows the inconsistencies and irregularities in my tagging. Each rule would fire a single error message:
e.g.

If the song name does not appear in the file name
If the songs have lyrics but no soloist
etc..

but I found that using only ifs to be very impractical because that requires me to repeat large chunks of tests in different parts of the expression.

Title: Re: Support for database expressions AND, OR, NOT
Post by: Lasse_Lus on November 22, 2009, 03:51:26 pm
that's why you have search lists  :)   (add category..search list and there you have "or" and "and" inclusive all other goodies)

you can also use smartlists groups in the views, but the you will loose performance...go for searchlist
Title: Re: Support for database expressions AND, OR, NOT
Post by: glynor on November 22, 2009, 04:39:13 pm
I don't know... I also agree that simple AND, OR, and XOR logical operators would dramatically improve the (human-readable) clarity of the expression language, which would make it easier to learn and more powerful.  Not having them is like trying to write code for very old bare metal like a PDP-8 or something.

I may be missing something in their use, but I don't see how Search Lists provide the same functionality.  Certainly not in many cases, and there are plenty of places where you can't use them (like when using expressions for tagging or quick searches, rather than as a pane).

Currently all expressions you add are effectively "AND-ed" to each other.  It is easy to do this in a search:

([Artist] = "simon" AND [Artist] = "garfunkel") : returns only those containing both "simon" and "garfunkel", but not each choice alone.

But, I want to be able to do things like this in a search:

([Artist] = "simon" OR [Artist] = "garfunkel") : returns all artists containing "simon", "garfunkel" and those containing both "simon" & "garfunkel"

and also be able to...

([Artist] = "simon" XOR [Artist] = "garfunkel") : returns those containing "simon" but not "garfunkel", and those containing "garfunkel" but not "simon"

Can you show me how to do all three without using complicated IF-THEN-ELSE logic statements?   I'd be all ears!  AND, OR, and XOR are pretty essential components of any modern logical language.
Title: Re: Support for database expressions AND, OR, NOT
Post by: Lasse_Lus on November 22, 2009, 05:52:38 pm
i must misunderstand you glynor..but this is not what you are after ?

nr3)

(([Artist]="simon" and -[Artist]="garfunkel") or ([Artist]="garfunkel" and -[Artist]="simon"))

Title: Re: Support for database expressions AND, OR, NOT
Post by: glynor on November 23, 2009, 11:15:07 am
I had no idea that they had added true "OR" support!  When did this happen?  I must have been sleeping (or I forgot due to too much wine).  Indeed, that does work.  An XOR logical operator would make it more clear, but that's fine.  I didn't realize that we had true "OR" support now, though!
Title: Re: Support for database expressions AND, OR, NOT
Post by: marko on November 23, 2009, 12:28:33 pm
Quote
When did this happen?

http://yabb.jriver.com/interact/index.php?topic=46456.0

;)
Title: Re: Support for database expressions AND, OR, NOT
Post by: glynor on November 23, 2009, 01:13:58 pm
http://yabb.jriver.com/interact/index.php?topic=46456.0

;)

Totally missed it.  Wow...  ::)
Title: Re: Support for database expressions AND, OR, NOT
Post by: Tolga on January 18, 2010, 08:11:00 pm
Guys, sorry late followup, but or/and/xor relations do not seem to work in the condition part of an If( ) expression function. If we had a expression function that checks membership for a playlist, the problem would also be solved but I don't know an expression function that does that.