INTERACT FORUM

Please login or register.

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

Author Topic: Is "-1" a problem?  (Read 3009 times)

wburkett

  • World Citizen
  • ***
  • Posts: 109
Is "-1" a problem?
« 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.
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Is "-1" a problem?
« Reply #1 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.
Logged

mark_h

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1855
Re: Is "-1" a problem?
« Reply #2 on: January 07, 2016, 02:53:18 am »

Did you try escaping the - in the expression, eg

[MyRating]=[/-1]
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Is "-1" a problem?
« Reply #3 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.
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42446
  • Shoes gone again!
Re: Is "-1" a problem?
« Reply #4 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.
Logged
Matt Ashland, JRiver Media Center

wburkett

  • World Citizen
  • ***
  • Posts: 109
Re: Is "-1" a problem?
« Reply #5 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
Logged
Pages: [1]   Go Up