INTERACT FORUM

More => Old Versions => Media Center 12 (Development Ended) => Topic started by: 221bBS on June 13, 2007, 07:45:25 pm

Title: Help with expression
Post by: 221bBS on June 13, 2007, 07:45:25 pm
I was wondering if someone could write an expression for me. I want to use the following fields in an expression.

[Name (Base)] [[Artist (Featuring)]] [[Name (Version)]] [[Live]]

But if a field is empty I end up with " []" in empty fields. They end up looking like this

Get Up And Jump [] [Demo Version] []

Can someone write an expression that will strip " []", so it ends up looking like this

Get Up And Jump [Demo Version]
Title: Re: Help with expression
Post by: marko on June 14, 2007, 02:05:05 am
depends where you want to use it...

If you want to it use to output descriptive info somewhere within the GUI use:

[Name (Base)] if(isempty([[Artist (Featuring)]]),,[[Artist (Featuring)]]) if(isempty([[Name (Version)]]),,[[Name (Version)]]) if(isempty([[Live]]),,[[Live]])

If you want to use it in a rename files from properties rule, use:

[Name (Base)] if(isequal([[Artist (Featuring)]],unknown,8),,[[Artist (Featuring)]]) if(isequal([[Name (Version)]],unknown,8),,[[Name (Version)]]) if(isequal([[Live]],unknown,8),,[[Live]])

I knocked those out without testing, but they should work OK. Just shout if they need more attention.

-marko.
Title: Re: Help with expression
Post by: 221bBS on June 14, 2007, 12:13:18 pm
Thanks for your help...I was able to get the result i kinda wanted by using

[Name (Base)] if(isempty([Artist (Featuring)]),,[[Artist (Featuring)]]) if(isempty([Name (Version)]),,[[Name (Version)]]) if(isempty([Live]),,[[Live]])

The only problem is that this creates unwanted spaces. Using the previous example would result in (will use <space> for unwanted space)

Get Up And Jump <space>[Demo Version]<space>

Is there anyway to fix this?

I also had another expression problem. Is there a way to use expressions to replace words with another. Here's what I want to do. I want to use

[Artist] [Artist (Featuring)]

in and expression and have (will use <space> for space)
<space>feat.<space>
<space>vs.<space>
<space>|<space>
 
replaced with ";"
Title: Re: Help with expression
Post by: marko on June 14, 2007, 01:20:36 pm
Quote
The only problem is that this creates unwanted spaces. Using the previous example would result in (will use <space> for unwanted space)
I didn't think about that! This should take care of the unwanted spaces...

[Name (Base)]if(isempty([Artist (Featuring)]),,/ [[Artist (Featuring)]])if(isempty([Name (Version)]),,/ [[Name (Version)]])if(isempty([Live]),,/ [[Live]])


Quote
I also had another expression problem. Is there a way to use expressions to replace words with another.
You can use expressions to replace whole strings with another. Could you try explaining what you want replaced with ";" again because I'm not quite getting it.

<space>feat.<space> ~ [artist]if(isempty([artist (featuring)]),,/ feat. [artist (featuring)])
<space>vs.<space> ~ [artist]if(isempty([artist (featuring)]),,/ vs. [artist (featuring)])

-marko
Title: Re: Help with expression
Post by: 221bBS on June 14, 2007, 02:05:57 pm
Quote
[Name (Base)]if(isempty([Artist (Featuring)]),,/ [[Artist (Featuring)]])if(isempty([Name (Version)]),,/ [[Name (Version)]])if(isempty([Live]),,/ [[Live]])

Works GREAT  ;D Thanks again!

Quote
You can use expressions to replace whole strings with another. Could you try explaining what you want replaced with ";" again because I'm not quite getting it.

Here's an example
[Artist]=Elvis Presley vs. Junkie XL
[Artist (Featuring)]=feat. Ella Fitzgerald | Louis Armstrong

[Artist] [Artist (Featuring)]=Elvis Presley vs. Junkie XL feat. Ella Fitzgerald | Louis Armstrong

I want to replace " vs. ", " feat. " and " | " with ";" so it will look like this

Elvis Presley;Junkie XL;Ella Fitzgerald;Louis Armstrong

Example 2
[Artist]=Elvis Presley vs. Junkie XL
[Artist (Featuring)]=N/A

[Artist] [Artist (Featuring)]=Elvis Presley vs. Junkie XL<space>

end result being

Elvis Presley;Junkie XL
Title: Re: Help with expression
Post by: marko on June 14, 2007, 02:46:04 pm
The playing field area is huge, but does have its boundaries, and you have just reached one of them :)
We can say "if the field contains ' vs. ' then display this", but we can't do "if the field contains ' vs. ' then replace ' vs. ' with this"

You could create a new field, fill it 'inline' using =[Artist] [Artist (Featuring)] and then use the find/replace tool to get the semicolons in place. This new field would need to be maintained manually.

-marko.
Title: Re: Help with expression
Post by: 221bBS on June 14, 2007, 04:24:52 pm
Quote
The playing field area is huge, but does have its boundaries, and you have just reached one of them Smiley
We can say "if the field contains ' vs. ' then display this", but we can't do "if the field contains ' vs. ' then replace ' vs. ' with this"
Bummer  :(

Quote
You could create a new field, fill it 'inline' using =[Artist] [Artist (Featuring)] and then use the find/replace tool to get the semicolons in place. This new field would need to be maintained manually.
That's how I've been doing it so far, I was hoping for an easier way.

Thanks for all your help  ;D