INTERACT FORUM

Please login or register.

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

Author Topic: Problem with LOAD/SAVE and calculated fields?  (Read 1087 times)

mark_h

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1855
Problem with LOAD/SAVE and calculated fields?
« on: March 08, 2013, 09:33:37 am »

I've been using the following rules since variables were added to count the tracks in my albums:

[Media Type]=[Audio]
[=save(0,v_tracks[album artist (auto)][album])1]=1
[=save(math(1+load(v_tracks[album artist (auto)][album])),v_tracks[album artist (auto)][album])1]=1

The problem I've hit is that I want to account for the various versions of albums I have, eg remasters, in my collection and need to be able to differentiate between the various albums.  The above rule lumps them together because of the use of [album] (they all share the same title of course...)

So I added a user field that creates a constructed field and appends the year of the album release to the title so that I can generate unique album titles, eg

Same Album (1974)
Same Album (1993)
Same Album (2013)

BUT putting that calculated field into the code above breaks it.

First step.

Create a user field that combines the existing fields above in order to make things more readable.

[albumname]=[album artist (auto)][album]

So the above becomes:

[Media Type]=[Audio]
[=save(0,v_tracks[albumname])1]=1
[=save(math(1+load(v_tracks[albumname])),v_tracks[albumname])1]=1

This works correctly.

But now put some code into the field and it breaks.  For instance:

[albumname]=if(1,[album artist (auto)][album],[album artist (auto)][album])

You can display the [albumname] field correctly, but the load/save logic no longer works correctly?

Spent a couple of hours on this but cannot find a solution that works when using expressions?

Anybody?


Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Problem with LOAD/SAVE and calculated fields?
« Reply #1 on: March 21, 2013, 09:54:09 am »

It appears that the comma in the If() statement confounds the parsing of the variable name.

Simplifying, you can get good results setting albumname to:

   clean([album artist (auto)][album])

but bad results setting it to:

   clean([album artist (auto)][album],1)

So this seems like an expression parsing problem.
Logged
The opinions I express represent my own folly.
Pages: [1]   Go Up