INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Support for database expressions AND, OR, NOT  (Read 1933 times)

Tolga

  • Regular Member
  • Galactic Citizen
  • ****
  • Posts: 438
Support for database expressions AND, OR, NOT
« 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.

Logged

Lasse_Lus

  • Citizen of the Universe
  • *****
  • Posts: 999
Re: Support for database expressions AND, OR, NOT
« Reply #1 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
Logged
MT5FR

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Support for database expressions AND, OR, NOT
« Reply #2 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.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

Lasse_Lus

  • Citizen of the Universe
  • *****
  • Posts: 999
Re: Support for database expressions AND, OR, NOT
« Reply #3 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"))

Logged
MT5FR

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Support for database expressions AND, OR, NOT
« Reply #4 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!
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8941
Re: Support for database expressions AND, OR, NOT
« Reply #5 on: November 23, 2009, 12:28:33 pm »

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

Tolga

  • Regular Member
  • Galactic Citizen
  • ****
  • Posts: 438
Re: Support for database expressions AND, OR, NOT
« Reply #7 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.
Logged
Pages: [1]   Go Up