INTERACT FORUM

More => Old Versions => Media Center 17 => Topic started by: akhunaton on April 26, 2012, 07:02:44 pm

Title: Custom rule question
Post by: akhunaton on April 26, 2012, 07:02:44 pm
How do I write a custom rule to show both of these in the same place. I have created a library field called "Genre 2" because my wife wants to tag some of my music with genre "Belly Dance" but I want to keep them as "World". I am trying to make a view that shows all of the Belly Dance Genre and also includes files tagged with Belly Dance under Genre 2.  This does not work> [Genre]=Belly Dance or [Genre 2]=Belly Dance
Title: Re: Custom rule question
Post by: 221bBS on April 26, 2012, 07:11:11 pm
Create a new expression field and enter this:

Code: [Select]
[Genre]If(IsEmpty([Genre 2]),,;[Genre 2])&datatype=[list]

This will combine the two field into one.
Title: Re: Custom rule question
Post by: MrC on April 26, 2012, 07:29:57 pm
Alternatively, let listbuild() do the work, replacing the if().  For a single string of semicolon/space-separated items:

   listbuild(1, ;/ , [Genre], [Genre 2])

or for the items individually listed under an expression column:

   listbuild(1, ;, [Genre], [Genre 2])&datatype=[list]
Title: Re: Custom rule question
Post by: akhunaton on April 26, 2012, 07:43:06 pm
I am not sure how to enter this (listbuild) in correctly into the "set rules for file display" area. thanks.
Title: Re: Custom rule question
Post by: MrC on April 26, 2012, 07:51:52 pm
Probably no need.  Where are you trying to see/use these?

  - as a category in a panes view?
  - as a column in the file list?
  - as a category in a categories view?
  - as a category in Theater View?
Title: Re: Custom rule question
Post by: akhunaton on April 26, 2012, 08:05:18 pm
I am using this as a library View called Belly Dance. Which contains all files tagged Genre=Belly Dance and all files tagged Genre 2=Belly Dance

thanks for your help.
Title: Re: Custom rule question
Post by: MrC on April 26, 2012, 08:08:26 pm
Right-click the view, and select Customize view.  What is the type listed under "View As" (the pull down)?
Title: Re: Custom rule question
Post by: akhunaton on April 26, 2012, 08:11:08 pm
View as Categories
Title: Re: Custom rule question
Post by: MrC on April 26, 2012, 08:20:40 pm
Customize the view.  Remove the Genre category under "Show Categories In This Order", and Add a new category of type Expression, setting this as the value:

   listbuild(1, ;, [Genre], [Genre 2])&datatype=[list]

Name it something like "Genres", or whatever you like.  Move it to the top of the list where Genre was.

You're replacing the category being used to drill down with your combined category list.
Title: Re: Custom rule question
Post by: akhunaton on April 26, 2012, 08:40:51 pm
Sweet! that worked beautifully, thanks!  :D
Title: Re: Custom rule question
Post by: akhunaton on April 26, 2012, 08:54:10 pm
whoops. Actually no it did not work. What now is needed for it to show genre=Belly Dance or genre 2=Belly Dance?
Title: Re: Custom rule question
Post by: MrC on April 26, 2012, 10:10:05 pm
Ah, I see, you're creating a view that shows ONLY tracks with Genre or Genre 2 containing Belly Dance.

Set the rules for file display to this (you can use the Import/Export button to copy/paste)

   ([Genre]=[Belly Dance] or [Genre 2]=[Belly Dance])

Note the parens - they mean OR.  You'll see them after you click OK in the wizard.

You can remove that Genres category expression created earlier.
Title: Re: Custom rule question
Post by: akhunaton on April 26, 2012, 10:49:41 pm
Perfect! many thanks.