INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Help for writing expression  (Read 502 times)

Otello

  • World Citizen
  • ***
  • Posts: 204
Help for writing expression
« on: May 14, 2020, 05:18:47 pm »

Hi, I'd need a quick help:
I want to write a library field working the same way of [album artist auto], i.e: if [tag1] exist use it, otherwise use [tag 2].

Thanks in advance  ::)
Logged

Doof

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 5908
  • Farm Animal Stupid
Re: Help for writing expression
« Reply #1 on: May 14, 2020, 06:08:11 pm »

Code: [Select]
If(!IsEmpty([tag1]), [tag1], [tag2])or
Code: [Select]
FirstNotEmpty([tag1], [tag2])
I'm actually using the first form for a field that I use in a similar fashion to [Album Artist (auto)] but I'll probably switch it in favor of the FirstNotEmpty() version. The nice thing about FirstNotEmpty is that you can add as many levels as you want to it.

For example
Code: [Select]
FirstNotEmpty([tag1], [tag2], [tag3], [tag4], No more to check!)
Would cycle through all four of those tags in order and if none of them have anything then it'll finally just output the "No more to check!" string at the end.
Logged

Otello

  • World Citizen
  • ***
  • Posts: 204
Re: Help for writing expression
« Reply #2 on: May 15, 2020, 01:57:55 pm »

The nice thing about FirstNotEmpty is that you can add as many levels as you want to it.

For example
Code: [Select]
FirstNotEmpty([tag1], [tag2], [tag3], [tag4], No more to check!)
Would cycle through all four of those tags in order and if none of them have anything then it'll finally just output the "No more to check!" string at the end.

Great! Many thanks,  ;D
Logged
Pages: [1]   Go Up