if-then-else structure not working

Any questions? Need some help?
Post Reply
vriesnet
Posts: 2
Joined: 29 Jan 2019, 13:42

if-then-else structure not working

Post by vriesnet »

I created the following format for Movies:

Code: Select all

Movies/{collection ? {"${collection}/${y}.${n.colon("|")}/${collection.replace(" Collection","")}[${ci}]."} : {"${ny.colon("|")}/"}}{ny.colon("|")}{".${lang}"}
Result when Movie is in Collection:
Movies/Avatar Collection/2009.Avatar/Avatar[1].Avatar (2009).mkv

Expected result when Movie is not in Collection (else-part):
Movies/Avatar (2009)/Avatar (2009).mkv

Actual result when Move is not in Collection:
Movies/Avatar (2009.mkv

Conclusion:
Movies that are part of a collection are processed ok. :)
The expected else-part of the format (when Movie is not part of a collection) is however omitted in the resulting filename. :?:

When I test the format in the Windows application with an optional if-statement "(collection == null)" the result of the else-part is formatted ok (on screen that is).
What am I doing wrong?
User avatar
rednoah
The Source
Posts: 22898
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: if-then-else structure not working

Post by rednoah »

Here's an example that works for both cases:

Code: Select all

Movies/
{
    any{collection / "$y.$n" / collection.before('Collection') + "[$ci]."}
       {ny + '/'}
}
{plex.name}

Here's an explanation of how and why it works:
viewtopic.php?f=5&t=1895


:idea: collection == null doesn't work because {collection} is never null because instead of returning with a null value, it'll throw an error.
:idea: Please read the FAQ and How to Request Help.
vriesnet
Posts: 2
Joined: 29 Jan 2019, 13:42

Re: if-then-else structure not working

Post by vriesnet »

Wow, thanks for your quick response!
Your suggestion works as expected.
Yammers
Posts: 21
Joined: 27 Jan 2018, 16:40

Re: if-then-else structure not working

Post by Yammers »

Hi there i am looking for something similar but i do not want it to name the folder Alien Collection i just want to see Alien, then inside that folder all the alien films.
Post Reply