Tag Action Formatting Rule Expression/Function Question

Hi,

I've got a number of actions setup within MP3Tag, and all is working well.

I do have on action which is to work on the "YEAR" atom (of an MP4 file), but which seems to constantly give me a result which is not what I expect.

I think a second set of eyes would help here:

Here is my action rule/function for the "YEAR" atom:

$if($len($trim(%year%)) >= 4,$left(%year%,4)-01-01T12:00:00,%year%)

My expected behavior is that: If the length of the "year" atom is greater than or equal to 4, the year atom should concatenate "-01-01T12:00:00" to the first 4 characters of the existing "year" atom. If the length is less than 4, keep the year atom as is.

However, when I run this rule, although the result of the length function is correctly calculated, I always seem to go into the concatenation (ie "true") rule (which does work)... the "else" rule never seems to get fired...

Does anyone see anything obvious that I've messed up?

This is strange, because I have a similar rule for my "ALBUM" atom, which works perfectly:

$if($len($trim(%album%)) > 0,$if($eql(%album%,%title%),%title%,%album%),%title%)

(If the album atom is empty, or if it has a value equal to title atom, put title atom's value in it. Otherwise, leave it as is.)

I've just stopped at this line and did not read further on.
Please have a look into Mp3tag scripting function help section and find out the fitting functions to use.

DD.20100112.1934.CET

If you know/see what is wrong, it would be "nice" of you to just say it... Or at least say WHICH of the functions you see a problem with. It is not as if I just hit an issue, and the first thing I did was post asking for help.

$if($len($trim(%year%)) >= 4,$left(%year%,4)-01-01T12:00:00,%year%)

Broken down, the above is:

if (Length of trimmed %year% is >= 4)
{
return ((first four char of %year%) concatenated with -01-01T12:00:00)
}
else
{
return (%year%)
}

Functions used:

$if(x,y,z) if x is true, y is returned, otherwise z.
$len(x) Returns the length of string x.
$trim(x) trims all leading and trailing whitespaces from the string x.
$left(x,n) Leftmost n characters of text x.

If you don't want to help, please don't. If you see something wrong (and it could be obvious), at least give a hint. I'm a former C++,C, Java, PowerBuilder, COBOL, Shell programmer, and now lead systems designer/PM. I know what I'm doing, but I'm not too humble to ask.

Again, I'm sure I missed something obvious. RTFM was already done.

It seems to me that you did not look too hard into the syntax documentation of the Mp3tag scripting language, so please look at the comparison operator you've used.

DD.20100112.2201.CET

It seems to me that there is a stick firmly planted up your .....

At any rate. Got it. Thanks for your ever so generous pointer.

Thanks,

btw. IF you had bothered to read my second example, you would have noticed that I used the proper syntax there... When it's a simple slip of the mind (meaning using a programming languages syntax in one part in error), a little helpfulness and kindness goes a long way.

At the end of the day, I know 3 people on this forum now:
Florian: Awesome and helpful.
Dano: Knowledgable, and willing to help.

You: Dick.

Not likely.

An outstanding programmer needs not so much help like a beginner.

Congratulations for the discovery!
It has proved once again that all that what one has ever learned is in some moments worth nothing.

DD.20100112.2340.CET

I think we can stop now.