INTERACT FORUM

More => Old Versions => JRiver Media Center 30 for Windows => Topic started by: wraith on September 18, 2024, 09:04:18 pm

Title: Excluding [Track #] Field in ListBuild Expression
Post by: wraith on September 18, 2024, 09:04:18 pm
Hi

I'm trying to create an expression that will rename my files in the format:
   [Album] - [Track #] - [Artist] - [Name]

with any empty fields being excluded from the name [including the " - " between].

The expression I've created so far is:

Code: [Select]
listbuild(1, / -/ ,
[Album,0],
[Track #, 0],
[Artist,0],
[Name,0]
)

The above is, so far, working with the string fields but I'm getting stuck with the [Track #] field. The [Track #] field replaces an empty field with "00", and I would prefer it excluded. I understand, from my web, expression wiki and forum searches, this behaviour is by design. As such, I've played around with FormatNumber, Delimit etc. and can't get it to be excluded.

Would appreciate feedback on how to exclude the [Track #] field [and, I'm presuming, any other numeric fields].

Thanks in advance
Title: Re: Excluding [Track #] Field in ListBuild Expression
Post by: zybex on September 19, 2024, 02:49:49 am
Hi wraith, there are several ways. Try this one:
Code: [Select]
listbuild(1, / -/ ,
[Album],
if([Track #], [Track #],),
[Artist],
[Name]
)

This works by checking if [track #] is "false" (a zero value is false in the Expression Language).
Title: Re: Excluding [Track #] Field in ListBuild Expression
Post by: wraith on September 19, 2024, 03:50:01 am
Hi zybex.

Thanks for helping out.

Tried your suggestion and still outputting "00". I'm still hunting. Any other ideas?

Title: Re: Excluding [Track #] Field in ListBuild Expression
Post by: zybex on September 19, 2024, 04:01:54 am
Strange. The renaming tool does some weird things. Try:
Code: [Select]
listbuild(1, / -/ ,
[Album],
if(isempty([Track #]),,[Track #]),
[Artist],
[Name]
)

Or:
Code: [Select]
listbuild(1, / -/ ,
[Album],
if([Track #, 0], [Track #],),
[Artist],
[Name]
)
Title: Re: Excluding [Track #] Field in ListBuild Expression
Post by: wraith on September 19, 2024, 04:10:07 am
No luck. Both those options still output "00" :(
Title: Re: Excluding [Track #] Field in ListBuild Expression
Post by: zybex on September 19, 2024, 04:14:52 am
Well, let's try another way:
Code: [Select]
replace(listbuild(1, / -/ ,
[Album],
[Track #,0],
[Artist],
[Name]),- 00 -,-)
Title: Re: Excluding [Track #] Field in ListBuild Expression
Post by: lepa on September 19, 2024, 10:13:47 am
This should work also with RMC tool
Code: [Select]
listbuild(1, / -/ ,
[Album,0],
If(Compare([Track #],>,0),[Track #],),
[Artist,0],
[Name,0])

you can also add padding to track# make it look more clean in explorer
Code: [Select]
listbuild(1, / -/ ,
[Album,0],
If(Compare([Track #],>,0),PadNumber([Track #],2),),
[Artist,0],
[Name,0])
Title: Re: Excluding [Track #] Field in ListBuild Expression
Post by: wraith on September 19, 2024, 08:09:19 pm
Hi Lepa,
The Compare function did the trick, thank you! :)

Hi Zybex,
Thanks for helping out, as well :)