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
Use a Loop Macro in a Function Expression
mugicagonzalez_
Member Posts: 14 Contributor I
Hello all
It's possible to "Generate Attribute" with a function expression that includes an attribute (for example var1 = var + 1).
If I now want to replace these variables with macros, it doesn't work (because it is seen as text, and not as a variable). (for example %{loop-var} = %{loop-var} + 1
Example in here (all imported vars starting with Wh are numerical).
How do I bypass this?
Thanks
Pello
It's possible to "Generate Attribute" with a function expression that includes an attribute (for example var1 = var + 1).
If I now want to replace these variables with macros, it doesn't work (because it is seen as text, and not as a variable). (for example %{loop-var} = %{loop-var} + 1
Example in here (all imported vars starting with Wh are numerical).
<div><?xml version="1.0" encoding="UTF-8"?><process version="8.1.003"></div><div> <context></div><div> <input/></div><div> <output/></div><div> <macros/></div><div> </context></div><div> <operator activated="true" class="process" compatibility="8.1.003" expanded="true" name="Process"></div><div> <process expanded="true"></div><div> <operator activated="true" class="retrieve" compatibility="8.1.003" expanded="true" height="68" name="Retrieve values" width="90" x="45" y="34"></div><div> <parameter key="repository_entry" value="//Local Repository/data/delete_me/values"/></div><div> </operator></div><div> <operator activated="true" class="concurrency:loop_attributes" compatibility="8.1.003" expanded="true" height="82" name="Loop Attributes" width="90" x="179" y="34"></div><div> <parameter key="attribute_filter_type" value="regular_expression"/></div><div> <parameter key="regular_expression" value="Wh_.+"/></div><div> <parameter key="attribute_name_macro" value="loop_Wh"/></div><div> <parameter key="enable_parallel_execution" value="false"/></div><div> <process expanded="true"></div><div> <operator activated="true" class="generate_attributes" compatibility="8.1.003" expanded="true" height="82" name="Generate Attributes (11)" width="90" x="112" y="34"></div><div> <list key="function_descriptions"></div><div> <parameter key="k%{loop_Wh}" value="%{loop_Wh} / 1000"/></div><div> </list></div><div> </operator></div><div> <connect from_port="input 1" to_op="Generate Attributes (11)" to_port="example set input"/></div><div> <connect from_op="Generate Attributes (11)" from_port="example set output" to_port="output 1"/></div><div> <portSpacing port="source_input 1" spacing="0"/></div><div> <portSpacing port="source_input 2" spacing="0"/></div><div> <portSpacing port="sink_output 1" spacing="0"/></div><div> <portSpacing port="sink_output 2" spacing="0"/></div><div> </process></div><div> </operator></div><div> <connect from_op="Retrieve values" from_port="output" to_op="Loop Attributes" to_port="input 1"/></div><div> <connect from_op="Loop Attributes" from_port="output 1" to_port="result 1"/></div><div> <portSpacing port="source_input 1" spacing="0"/></div><div> <portSpacing port="sink_result 1" spacing="0"/></div><div> <portSpacing port="sink_result 2" spacing="0"/></div><div> </process></div><div> </operator></div><div></process></div>
How do I bypass this?
Thanks
Pello
Tagged:
0
Best Answer
-
mugicagonzalez_ Member Posts: 14 Contributor ISolved by using the "eval" function: eval(%{loop-var}) = eval(%{loop-var}) + 12