Alberto GZ Posted September 18, 2014 Report Share Posted September 18, 2014 I create a custom attribute called "Photo kind" of type Expression and result Text. I want get three coded characters of Shot Name, and return a specific text value. Example: Shot names contain words "AMB", "DET", or "VAR". Then if name contains "DET", text value will be "detail". For this I use a conditional, but I don't see how to evaluate more of two conditions. Here my current sentence for this, but in any Shot Name always show value "ambient" {func.IF(self.name <= 'AMB', 'ambient', func.IF(self.name<='DET', '', 'detail'))} Link to comment Share on other sites More sharing options...
Mattias Seebergs Posted September 19, 2014 Report Share Posted September 19, 2014 Hi, Try this instead:{func.IF(self.name <= 'AMB', 'ambient', func.IF(self.name <= 'DET', 'detail', func.IF(self.name <= 'VAR', 'variable', 'none')))}Let me know what you think. Thanks,Mattias Link to comment Share on other sites More sharing options...
Alberto GZ Posted September 22, 2014 Author Report Share Posted September 22, 2014 Thank you Mattias for your reply.The sentence on your example also return to me for any shot name 'ambient' value.I think that only evalue up to first match. There is no 'else' inside conditional? Link to comment Share on other sites More sharing options...
Mattias Seebergs Posted September 22, 2014 Report Share Posted September 22, 2014 The IF function syntax is:func.IF(expression1, expression2, expression3)which means expression3 is the 'else' statement. I've modified my example slightly, please try the following instead:{func.IF(func.locate('AMB', self.name), 'ambient', func.IF(func.locate('DET', self.name), 'detail', func.IF(func.locate('VAR', self.name), 'variable', 'none')))} Link to comment Share on other sites More sharing options...
Alberto GZ Posted September 22, 2014 Author Report Share Posted September 22, 2014 Yeah! Now runs ok! Thanks Mattias.Why enclose condition into location function? What's do it? Link to comment Share on other sites More sharing options...
Mattias Seebergs Posted September 23, 2014 Report Share Posted September 23, 2014 The locate function determines if the first parameter ('AMB' for instance) is present in the second parameter (self.name), and if so it returns true, otherwise false. Hope this is more clear now. Mattias Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.