... if I add $if($stricmp(%genre%,Rock),%genre% at the end it gives me a error !
It would have been easier if you had shown us the complete string instead of merely writing "at the end", I suppose.
Look at the original string again, now split up in a few lines:
$if(
$stricmp(%genre%,classical),%genre%,
$if(
$stricmp(%genre%,comedy),%genre%,
$if(
$stricmp(%genre%,blues),%genre%,Unsorted
)
)
)
The 'Unsorted' gives the rest of the library. We want to add an extra $if statement with a rock genre
$if($stricmp(%genre%,rock),%genre%)
moving the 'Unsorted' to a new level:
$if(
$stricmp(%genre%,classical),%genre%,
$if(
$stricmp(%genre%,comedy),%genre%,
$if(
$stricmp(%genre%,blues),%genre%,
$if(
$stricmp(%genre%,rock),%genre%,Unsorted
)
)
)
)
And in one line
$if($stricmp(%genre%,classical),%genre%,$if($stricmp(%genre%,comedy),%genre%,$if($stricmp(%genre%,blues),%genre%,$if($stricmp(%genre%,rock),%genre%,Unsorted))))
You may have forgot to type a parenthesis somewhere. I can recommend foosion's Title Formatting Sandbox as a validator, see screenshot. Note the error message.
The component doesn't like user-defined words, but doesn't throw an error, see screenshot.
You would be better off using Facets' standard genre pattern
$if2(%<genre>%,'('Unknown')')
instead of making more and more complicated strings. Use the Filter to define some simple query syntax filters and activate the Multiple filters to combine them.