INTERACT FORUM

More => Old Versions => JRiver Media Center 18 for Windows => Topic started by: apostos on January 02, 2013, 11:53:39 am

Title: An easy one for you syntax gurus ...
Post by: apostos on January 02, 2013, 11:53:39 am
What I’m trying to accomplish – a custom field called “resolution” for display in the Movie views (small & large). This field will use an expression (unfortunately, yet to be determined).

Basically – If [Width] = 1920  and [Height] = 1080 is true, then display 1080p - or else - if [Width] = 1280  and [Height] = 720 is true then display 720p.

I’ve created the new field (apparently that’s the easy part), but so far I’ve been struggling with the expression language. Multiple attempts in and I’m still creating expression gobbledygook with no sign of progress …

Any help much appreciated.
Title: Re: An easy one for you syntax gurus ...
Post by: MrC on January 02, 2013, 01:04:09 pm
Using the existing [Dimensions] field:

IfElse(
   IsEqual([Dimensions], 1920 x 1080), 1080p,
   IsEqual([Dimensions], 1280 x 720), 720p,
   1, Other
)

You can remove the Other line if you don't want anything output for non 1080p / 720p cases.
Title: Re: An easy one for you syntax gurus ...
Post by: apostos on January 02, 2013, 03:58:10 pm
Boy, was I on the wrong track.

Thanks for that.
Title: Re: An easy one for you syntax gurus ...
Post by: MrC on January 02, 2013, 05:03:15 pm
I think you had it nailed, and could do it with the two fields [Width] and [Height].  Consider how it would look:

IfElse(
   IsEqual([Width] [Height], 1920 1080), 1080p,
   IsEqual([Width] [Height], 1280 720), 720p,
   1, Other
)

This implicitly does the AND you suggested, by concatenating the values together and doing a single comparison.  Its a nice little trick to avoid the Boolean logic shortcomings in the expression language.  The IfElse() provides the OR.