INTERACT FORUM
More => Old Versions => JRiver Media Center 24 for Windows => Topic started by: SkGe on December 20, 2018, 04:18:12 am
-
Hello there.
I struggle to create a expression and it seems i'm not able to solve by myself. If someone who have a better knowledge about it, maybe can help me.
The expression is this:
if(ListContains([publication rating], AllMusic-0.5, 0), 10,)if(ListContains([publication rating], AllMusic-1, 0), 20,)if(ListContains([publication rating], AllMusic-1.5, 0), 30,)if(ListContains([publication rating], AllMusic-2, 0), 40,)if(ListContains([publication rating], AllMusic-2.5, 0), 50,)if(ListContains([publication rating], AllMusic-3, 0), 60,) if(ListContains([publication rating], AllMusic-3.5, 0), 70,)if(ListContains([publication rating], AllMusic-4, 0), 80,)if(ListContains([publication rating], AllMusic-4.5, 0), 90,)if(ListContains([publication rating], AllMusic-5, 0), 100,)
So the expression instead show me the value i have in that field, when meet the .5 value it show the same value where is none.
Ex of the custom field:
AllMusic-3 value it shows 60
AllMusic-3.5 value it show 60, instead as 70. The problem i think it is in these .5 and dunno how to avoid this issue.
I did try different variants of expression but none work.
Thanks
-
i would certainly look at using ifelse() instead of if()
ifelse(ListContains([publication rating], AllMusic-0.5, 0), 10,ListContains([publication rating], AllMusic-1, 0), 20,ListContains([publication rating], AllMusic-1.5, 0), 30,ListContains([publication rating], AllMusic-2, 0), 40,ListContains([publication rating], AllMusic-2.5, 0),ListContains([publication rating], AllMusic-3, 0), 60,ListContains([publication rating], AllMusic-3.5, 0), 70,ListContains([publication rating], AllMusic-4, 0), 80,ListContains([publication rating], AllMusic-4.5, 0), 90,ListContains([publication rating], AllMusic-5, 0), 100,)
i didn't test that so watch the brackets etc. but it will be closer
-
From your description of what is happening it looks like the decimal place is causing a problem. Try putting an escape character in front of the decimal places eg 1/.5, 2/.5 etc - it might help. Using ferday's expression is also a lot simpler than the string of if statements.