The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here
Generate Attribute for binomials
The "Generate Attributes" operator allows to define an if() statement as an expression on attributes that does not seem to work on binominals in Rapid 5.2.003
For example, the binominal attribute for a simple traffic light is color={RED, GREEN}, and i would like to generate a new attribute 'drive' with values {STOP, GO}.
The Generate Attributes operator has a new attribute = "drive" and function expression = "if(color=RED,STOP,GO)".
Running this results in a Process Failed window with the message "Generation exception:"No such attribute: "STOP"
An operator failed to generate a new attribute, macro or other object which is calculated on the fly. Reason: No such attribute: 'STOP'"
Since the on-line help does not exclude binomials attributes, i suppose is should work, somehow.
Does anyone know how to?
For example, the binominal attribute for a simple traffic light is color={RED, GREEN}, and i would like to generate a new attribute 'drive' with values {STOP, GO}.
The Generate Attributes operator has a new attribute = "drive" and function expression = "if(color=RED,STOP,GO)".
Running this results in a Process Failed window with the message "Generation exception:"No such attribute: "STOP"
An operator failed to generate a new attribute, macro or other object which is calculated on the fly. Reason: No such attribute: 'STOP'"
Since the on-line help does not exclude binomials attributes, i suppose is should work, somehow.
Does anyone know how to?
Tagged:
0
Answers
I think you need a double equals (==) and to quote the values, like this... I recommend the little wizard that helps with the regex in the generating operator, it sure helps..
Good weekend
Thanks for the help. The quotes solves the problem: if(color=="RED","STOP","GO")
The '==' was just a typo in my post indeed.
Interesting why the error was generated for the second erroneous value (STOP) and not for the first in the comparison operation (RED).
The wizard may be useful but i did not bother to define the value type of the import data, and apparently the wizard ignores the binominal values in the Attributes list, and also does not mind whether you use quotes or not (RED or "RED" are both OK).