INTERACT FORUM

More => Old Versions => JRiver Media Center 21 for Windows => Topic started by: wburkett on January 06, 2016, 08:21:42 pm

Title: Is "-1" a problem?
Post by: wburkett on January 06, 2016, 08:21:42 pm
This is weird.  I created a field called "MyRating" which is a string.  Even though it is a string, I put in numeric integer values to rate songs.  For songs I haven't rated, I use a value "-1".  When I create a smartlist for unrated songs where "MyRating" "is" "-1", it doesn't work - I get everything.  If I change it to "4" or "5", etc, it works properly, but "-1" doesn't.  Does the rules engine interpret this as "True" or something rather than the character string "-1"?

EDIT: so I solved the problem by changing the datatype from string to integer.  But I still think it's odd that the smartplaylist rule didn't match the string "-1" correctly.
Title: Re: Is "-1" a problem?
Post by: blgentry on January 06, 2016, 08:52:39 pm
Confirmed.  I tried every quoting method I could think of to match on "-1" in a string field and it didn't work.  It matched on all files instead.

Then I changed the field type to integer.  Bam.  Problem solved; it matches correctly.

Why not make it an integer or decimal field?  It's a weird bug for sure, but this solution seems to fit the needs of rating media files numerically.

Brian.
Title: Re: Is "-1" a problem?
Post by: mark_h on January 07, 2016, 02:53:18 am
Did you try escaping the - in the expression, eg

[MyRating]=[/-1]
Title: Re: Is "-1" a problem?
Post by: blgentry on January 07, 2016, 09:09:42 am
^ Yes.  I tried MANY different expressions.  In fact, I think it's the escaping that's the problem.  MC puts it in automatically.  If you remove it (in import/export), MC puts it back.

Try it for yourself.

Brian.
Title: Re: Is "-1" a problem?
Post by: Matt on January 07, 2016, 09:21:28 am
I think this will be fixed in the next build (21.0.34 or later).

The string -1 triggered a range evaluation because the string was actually /-1 when we looked at it so the dash was at the second spot.  But that's just silly, so I made a fix.
Title: Re: Is "-1" a problem?
Post by: wburkett on January 10, 2016, 02:44:25 pm
Why not make it an integer or decimal field?  It's a weird bug for sure, but this solution seems to fit the needs of rating media files numerically.

I did - I left it as an integer after discovering that it worked as expected.

Thanks, all, for checking into it.  I'm glad my unknowing newbie ways uncovered something that needed fixing.  :-)

Bill