INTERACT FORUM

More => Old Versions => JRiver Media Center 19 for Windows => Topic started by: kensn on November 29, 2013, 01:12:39 pm

Title: Need expression nesting help
Post by: kensn on November 29, 2013, 01:12:39 pm
ifelse(!isempty([My Field 1]), Some Text [My Field 1] if(!isempty([Disc #]), - Disc #[Disc #]), !IsEmpty(([My Field 2]), Some Text [My Field 2] if(!isempty([Disc #]), - Disc #[Disc #]), !isempty([Disc #]), Disc #[Disc #]))

So if [My field 1] is not empty, I would like to show "Some Text [My Field 1] and if [Disc #] is not empty I would like to show it also, same with [My Field 2], or if they are both empty just show the Disc #.

Cant get the syntax.

Ken
Title: Re: Need expression nesting help
Post by: gappie on November 29, 2013, 04:41:42 pm
i think it is more helpful to copy the code you use and put it here.. :b but for now i would say the ( just before using [my field 2] breaks the ifelse thing. and if so take the ) at the end away.

 :)
gab

edit: or just change the ifelse in if?
Title: Re: Need expression nesting help
Post by: RJC on November 29, 2013, 04:58:38 pm
If you want to do ANDs and ORs you could try the Math() function:

IfElse(
Math(Compare([Watched], =, 1) & Compare([Number Plays], >, 0)), Watched,
Math(Compare([Watched], =, 0) | Compare([Number Plays], =, 0)), Unwatched,
Math(Compare([Watched], =, 1) & Compare([Number Plays], =, 0)), Special Case,
Math(Compare([Watched], =, 0) | Compare([Number Plays], >, 0)), Started
)
Title: Re: Need expression nesting help
Post by: 6233638 on November 29, 2013, 05:28:34 pm
I think you should be using delimit() (http://wiki.jriver.com/index.php/Media_Center_expression_language#Delimit.28.E2.80.A6.29:_Outputs_a_value_with_head.2Ftail_strings_when_value_is_non-empty) rather than if statements.
 
e.g.

Code: [Select]
if(!isempty([My Field 1]),
Some Text [My Field 1]delimit([Disc #],,/ -/ Disc/ #),
if(!isempty([My Field 2]),
Some Text [My Field 2]delimit([Disc #],,/ -/ Disc/ #),
Disc #[Disc #]))
Title: Re: Need expression nesting help
Post by: kensn on November 29, 2013, 09:38:49 pm
Thanks for all the ideas, I went with the delimit solution as I was trying that already, just could not get the syntax. Will work out what all the / do.

Thanks again..

ken