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
How to use macro to check condition
sgnarkhede2016
Member Posts: 152 Contributor II
Hello,
In generate attribute getting error in this condition "if(CY +%{opt}+ Avg3Yr_percentage,60,20)"
opt macro contain "<"
for reference i have attched my process and input file
In generate attribute getting error in this condition "if(CY +%{opt}+ Avg3Yr_percentage,60,20)"
opt macro contain "<"
for reference i have attched my process and input file
<?xml version="1.0" encoding="UTF-8"?><process version="9.5.001">
<context>
<input/>
<output/>
<macros/>
</context>
<operator activated="true" class="process" compatibility="9.5.001" expanded="true" name="Process">
<parameter key="logverbosity" value="init"/>
<parameter key="random_seed" value="2001"/>
<parameter key="send_mail" value="never"/>
<parameter key="notification_email" value=""/>
<parameter key="process_duration_for_mail" value="30"/>
<parameter key="encoding" value="SYSTEM"/>
<process expanded="true">
<operator activated="true" class="retrieve" compatibility="9.5.001" expanded="true" height="68" name="Retrieve testSgn" width="90" x="45" y="85">
<parameter key="repository_entry" value="//Local Repository/FinancialData/FinalProcess-2020/data/testSgn"/>
</operator>
<operator activated="true" class="generate_attributes" compatibility="9.5.001" expanded="true" height="82" name="Generate Attributes (2)" width="90" x="179" y="85">
<list key="function_descriptions">
<parameter key="thresh" value=""<,0.4""/>
</list>
<parameter key="keep_all" value="true"/>
</operator>
<operator activated="true" class="split" compatibility="9.5.001" expanded="true" height="82" name="Split" width="90" x="313" y="85">
<parameter key="attribute_filter_type" value="single"/>
<parameter key="attribute" value="thresh"/>
<parameter key="attributes" value=""/>
<parameter key="use_except_expression" value="false"/>
<parameter key="value_type" value="nominal"/>
<parameter key="use_value_type_exception" value="false"/>
<parameter key="except_value_type" value="file_path"/>
<parameter key="block_type" value="single_value"/>
<parameter key="use_block_type_exception" value="false"/>
<parameter key="except_block_type" value="single_value"/>
<parameter key="invert_selection" value="false"/>
<parameter key="include_special_attributes" value="true"/>
<parameter key="split_pattern" value=","/>
<parameter key="split_mode" value="ordered_split"/>
</operator>
<operator activated="true" class="extract_macro" compatibility="9.5.001" expanded="true" height="68" name="Extract Macro" width="90" x="447" y="85">
<parameter key="macro" value="opt"/>
<parameter key="macro_type" value="data_value"/>
<parameter key="statistics" value="average"/>
<parameter key="attribute_name" value="thresh_1"/>
<parameter key="example_index" value="1"/>
<list key="additional_macros">
<parameter key="percentage" value="thresh_2"/>
</list>
</operator>
<operator activated="true" class="guess_types" compatibility="9.5.001" expanded="true" height="82" name="Guess Types" width="90" x="581" y="85">
<parameter key="attribute_filter_type" value="all"/>
<parameter key="attribute" value=""/>
<parameter key="attributes" value=""/>
<parameter key="use_except_expression" value="false"/>
<parameter key="value_type" value="attribute_value"/>
<parameter key="use_value_type_exception" value="false"/>
<parameter key="except_value_type" value="time"/>
<parameter key="block_type" value="attribute_block"/>
<parameter key="use_block_type_exception" value="false"/>
<parameter key="except_block_type" value="value_matrix_row_start"/>
<parameter key="invert_selection" value="false"/>
<parameter key="include_special_attributes" value="false"/>
<parameter key="decimal_point_character" value="."/>
</operator>
<operator activated="true" class="generate_attributes" compatibility="9.5.001" expanded="true" height="82" name="Generate Attributes" width="90" x="715" y="85">
<list key="function_descriptions">
<parameter key="Avg3Yr_percentage" value="(Avg3Yr*eval(%{percentage}))"/>
<parameter key="Score" value="if(CY +#{opt}+ Avg3Yr_percentage,60,20)"/>
</list>
<parameter key="keep_all" value="true"/>
</operator>
<operator activated="false" class="generate_attributes" compatibility="9.5.001" expanded="true" height="82" name="Generate Attributes (3)" width="90" x="581" y="391">
<list key="function_descriptions">
<parameter key="Avg3Yr_percentage" value="(Avg3Yr*eval(%{percentage}))"/>
<parameter key="Score" value="if(CY +%{opt}+ Avg3Yr_percentage,60,20)"/>
</list>
<parameter key="keep_all" value="true"/>
</operator>
<connect from_op="Retrieve testSgn" from_port="output" to_op="Generate Attributes (2)" to_port="example set input"/>
<connect from_op="Generate Attributes (2)" from_port="example set output" to_op="Split" to_port="example set input"/>
<connect from_op="Split" from_port="example set output" to_op="Extract Macro" to_port="example set"/>
<connect from_op="Extract Macro" from_port="example set" to_op="Guess Types" to_port="example set input"/>
<connect from_op="Guess Types" from_port="example set output" to_op="Generate Attributes" to_port="example set input"/>
<connect from_op="Generate Attributes" from_port="example set output" to_port="result 1"/>
<portSpacing port="source_input 1" spacing="0"/>
<portSpacing port="sink_result 1" spacing="0"/>
<portSpacing port="sink_result 2" spacing="0"/>
</process>
</operator>
</process>
0
Best Answer
-
Vanlal Member Posts: 12 Contributor IIHi sgnarkhede2016 ,
<?xml version="1.0" encoding="UTF-8"?><process version="9.6.000"> <context> <input/> <output/> <macros/> </context> <operator activated="true" class="process" compatibility="9.6.000" expanded="true" name="Process"> <parameter key="logverbosity" value="init"/> <parameter key="random_seed" value="2001"/> <parameter key="send_mail" value="never"/> <parameter key="notification_email" value=""/> <parameter key="process_duration_for_mail" value="30"/> <parameter key="encoding" value="SYSTEM"/> <process expanded="true"> <operator activated="true" class="retrieve" compatibility="9.6.000" expanded="true" height="68" name="Retrieve testSgn" width="90" x="45" y="85"> <parameter key="repository_entry" value="//Local Repository/data/testSgn"/> </operator> <operator activated="true" class="generate_attributes" compatibility="9.6.000" expanded="true" height="82" name="Generate Attributes (2)" width="90" x="179" y="85"> <list key="function_descriptions"> <parameter key="thresh" value=""<,0.4""/> </list> <parameter key="keep_all" value="true"/> </operator> <operator activated="true" class="split" compatibility="9.6.000" expanded="true" height="82" name="Split" width="90" x="313" y="85"> <parameter key="attribute_filter_type" value="single"/> <parameter key="attribute" value="thresh"/> <parameter key="attributes" value=""/> <parameter key="use_except_expression" value="false"/> <parameter key="value_type" value="nominal"/> <parameter key="use_value_type_exception" value="false"/> <parameter key="except_value_type" value="file_path"/> <parameter key="block_type" value="single_value"/> <parameter key="use_block_type_exception" value="false"/> <parameter key="except_block_type" value="single_value"/> <parameter key="invert_selection" value="false"/> <parameter key="include_special_attributes" value="true"/> <parameter key="split_pattern" value=","/> <parameter key="split_mode" value="ordered_split"/> </operator> <operator activated="true" class="extract_macro" compatibility="9.6.000" expanded="true" height="68" name="Extract Macro" width="90" x="447" y="85"> <parameter key="macro" value="opt"/> <parameter key="macro_type" value="data_value"/> <parameter key="statistics" value="average"/> <parameter key="attribute_name" value="thresh_1"/> <parameter key="example_index" value="1"/> <list key="additional_macros"> <parameter key="percentage" value="thresh_2"/> </list> </operator> <operator activated="true" class="guess_types" compatibility="9.6.000" expanded="true" height="82" name="Guess Types" width="90" x="581" y="85"> <parameter key="attribute_filter_type" value="all"/> <parameter key="attribute" value=""/> <parameter key="attributes" value=""/> <parameter key="use_except_expression" value="false"/> <parameter key="value_type" value="attribute_value"/> <parameter key="use_value_type_exception" value="false"/> <parameter key="except_value_type" value="time"/> <parameter key="block_type" value="attribute_block"/> <parameter key="use_block_type_exception" value="false"/> <parameter key="except_block_type" value="value_matrix_row_start"/> <parameter key="invert_selection" value="false"/> <parameter key="include_special_attributes" value="false"/> <parameter key="decimal_point_character" value="."/> </operator> <operator activated="true" class="generate_attributes" compatibility="9.6.000" expanded="true" height="82" name="Generate Attributes" width="90" x="715" y="85"> <list key="function_descriptions"> <parameter key="Avg3Yr_percentage" value="(AVG3Yrs*eval(%{percentage}))"/> </list> <parameter key="keep_all" value="true"/> </operator> <operator activated="true" class="generate_attributes" compatibility="9.6.000" expanded="true" height="82" name="Generate Attributes (3)" width="90" x="715" y="289"> <list key="function_descriptions"> <parameter key="Score" value="if(thresh_1=="<" && CY < Avg3Yr_percentage,60,20)"/> </list> <parameter key="keep_all" value="true"/> </operator> <connect from_op="Retrieve testSgn" from_port="output" to_op="Generate Attributes (2)" to_port="example set input"/> <connect from_op="Generate Attributes (2)" from_port="example set output" to_op="Split" to_port="example set input"/> <connect from_op="Split" from_port="example set output" to_op="Extract Macro" to_port="example set"/> <connect from_op="Extract Macro" from_port="example set" to_op="Guess Types" to_port="example set input"/> <connect from_op="Guess Types" from_port="example set output" to_op="Generate Attributes" to_port="example set input"/> <connect from_op="Generate Attributes" from_port="example set output" to_op="Generate Attributes (3)" to_port="example set input"/> <connect from_op="Generate Attributes (3)" from_port="example set output" to_port="result 1"/> <portSpacing port="source_input 1" spacing="0"/> <portSpacing port="sink_result 1" spacing="0"/> <portSpacing port="sink_result 2" spacing="0"/> </process> </operator> </process>
Is this the result that you expected
5