INTERACT FORUM

Please login or register.

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

Author Topic: Upgraded to .147, and getting 'Expression Error (Unknown)'.  (Read 2320 times)

BartMan01

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1513

For MCiTuesSync, I have the field iTunesFileKey that translates the file name to that existing in the iTunes 'device' after sync.  It was working fine until I upgraded to .147 and now just returns 'Expression Error (Unknown)' as it's value.  Can anyone see an expression value in here that might have changed with the recent versions?:

If(IsEqual(FilePath(),\\ZEUS\Audio\iTunes Downloads, 8), [Filename], C:\Music\iTunes Library\Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace([Artist]|||[Album],<,_),>,_),:,_),",_),\,_),//,_),?,_),*,_),|||,\),|,_)\Replace(Replace([Filename (name)],.flac,.mp3),.ac3,.mp3),.\,\)

Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Upgraded to .147, and getting 'Expression Error (Unknown)'.
« Reply #1 on: May 13, 2012, 07:18:10 pm »

You're missing a closing paren at the end of the statement.  The last Replace is closed, but the If() statement is open.
Logged
The opinions I express represent my own folly.

BartMan01

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1513
Re: Upgraded to .147, and getting 'Expression Error (Unknown)'.
« Reply #2 on: May 13, 2012, 07:26:03 pm »

Thanks.  Figured it was something like that, just finished rebuilding it as:

If(IsEqual(FilePath(),\\ZEUS\Audio\iTunes Downloads, 8), [Filename], Replace(C:\Music\iTunes Library\Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace([Artist]|||[Album],<,_),>,_),:,_),",_),\,_),//,_),?,_),*,_),|||,\),|,_)\Replace(Replace([Filename (name)],.flac,.mp3),.ac3,.mp3),.\,\))

Two pleas/requests here:

One - please add a 'make text filename friendly' function.  You already have it in the product, I am just trying to emulate what you do when you write the track out to a 'handheld' and it takes all of those nested replaces to do it.  Please expose that function for use in the expression editor.

Two (and this one would be harder) - if possible can you make the expression editor work like the one in Excel - where the matching parenthesis go bold when you select them.  Would make troubleshooting and creating these much easier.
Logged

Scolex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1116
  • Cheers
Re: Upgraded to .147, and getting 'Expression Error (Unknown)'.
« Reply #3 on: May 13, 2012, 07:31:49 pm »


Two pleas/requests here:

Two (and this one would be harder) - if possible can you make the expression editor work like the one in Excel - where the matching parenthesis go bold when you select them.  Would make troubleshooting and creating these much easier.


I use Notepad++ when dealing with expressions or similar for this very reason.
Logged
Sean

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Upgraded to .147, and getting 'Expression Error (Unknown)'.
« Reply #4 on: May 13, 2012, 07:53:30 pm »

Here's a shorter and probably faster way to clean out those file system characters.  Instead of replacing one bad character per Replace, use the Clean() function in mode 3 to clean them all at once.  A wrinkle: it replaces the illegal FS characters with - instead of _, so we'll swap out the existing - characters temporarily, then clean() and replace - to _, and finally reset our marker to -.

Compare:

   Replace(Replace(Clean(Replace([field], -, XXX), 3), -, _), XXX, -)

vs.

   Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace([field], <, _), >, _), :, _), ", _), \, _), //, _), ?, _), *, _), |, _)

In your expression, you're using ||| as a marker.  If you change that marker to a non-illegal FS character string (e.g. ===), then you can move that Replace outside the Clean sequence, doing that replacement last:

   Replace(Replace(Replace(Clean(Replace([Artist]===[Album], -, XXX), 3), -, _), XXX, -), ===, \)
Logged
The opinions I express represent my own folly.

BartMan01

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1513
Re: Upgraded to .147, and getting 'Expression Error (Unknown)'.
« Reply #5 on: May 14, 2012, 05:16:58 am »

Here's a shorter and probably faster way to clean out those file system characters.  Instead of replacing one bad character per Replace, use the Clean() function in mode 3 to clean them all at once.  

The only possible issue I see with that is that per the documentation, the Clean() function removes ALL special characters instead of just those that are not legal in file names.  The results of the expression have to match the file location and name created my MC during 'export to handheld' and that leaves special characters that are file name friendly in place. 
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Upgraded to .147, and getting 'Expression Error (Unknown)'.
« Reply #6 on: May 14, 2012, 11:03:32 am »

I ran it across 47000 entries, and saw no issues.  You can compare for yourself to see how it works:

if(isequal(
  Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace([Album][Artist], <, _), >, _), :, _), ", _), \, _), //, _), ?, _), *, _), |, _),
  Replace(Replace(Clean(Replace([Album][Artist], -, XXX), 3), -, _), XXX, -)),
    Equivalent,
    [Album] [Artist]
)

As a bonus, this found 2 tracks with Artist names on a CD that happened to start with initial leading space.
Logged
The opinions I express represent my own folly.

BartMan01

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1513
Re: Upgraded to .147, and getting 'Expression Error (Unknown)'.
« Reply #7 on: May 14, 2012, 11:16:41 pm »

Thanks.  Had some mismatches whenever an X and a special character were together, but using ZXXXZ as the placeholder fixed that(X-Mas becomes -XMas).  Clean does seem to do this in an easier at manage way for this.
Logged

BartMan01

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1513
Re: Upgraded to .147, and getting 'Expression Error (Unknown)'.
« Reply #8 on: May 24, 2012, 04:57:05 pm »

Final update for anyone who needs a similar solution.  This is working for me now.  I replaced the 'xxx'/'zxxxz' convention with &DASH& and &SLASH& since clean leaves & in place and I needed to put back in dashes and needed to insert a slash between artist and album.  To me it is more readable and obvious, since I usually only find myself needing to tweak this at most once a year.  Here is the full equation in place now:

Code: [Select]
If(IsEqual(FilePath(),\\ZEUS\Audio\iTunes Downloads, 8), [Filename], Replace(Replace(C:\Music\iTunes Library\Replace(Replace(Replace(Clean(Replace([Artist]&SLASH&[Album], -, &DASH&), 3), -, _), &DASH&, -), &SLASH&, \)\Replace(Replace([Filename (name)],.flac,.mp3),.ac3,.mp3),.\,\),\\,\))
As compared to:

Code: [Select]
If(IsEqual(FilePath(),\\ZEUS\Audio\iTunes Downloads, 8), [Filename], Replace(Replace(C:\Music\iTunes Library\Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace([Artist]|||[Album],<,_),>,_),:,_),",_),\,_),//,_),?,_),*,_),|||,\),|,_)\Replace(Replace([Filename (name)],.flac,.mp3),.ac3,.mp3),.\,\),\\,\))
Doesn't look much different by length but goes from 14 replaces to 8 replaces + 1 clean.

Thanks to MrC for helping fix the problem and come up with a cleaner solution.
Logged
Pages: [1]   Go Up