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
"Filter Examples within Loop Values"
I am trying to process a spreadsheet in batches defined by rows having the same ID value.
My test spreadsheet contains 5 rows and 2 columns of the form :
ID Text
1 First row for id 1
2 First row for id 2
1 Second row for id 1
2 Second row for id 2
3 First row for id 3
My objective is to use Loop Values to iterate through this data set once for each unique value of ID and only return the result set of rows for that ID.
When I use Loop Values operator and connect to Data to Document operator, I get the text for all 5 rows for each iteration of ID.
When I connect Loop Values to Filter Examples and apply the attribute value filter, I get the text for the rows that match the specified value for each iteration of ID.
What i want is to be able to do is match attribute value with the loop_value, but I don't know how to specify the condition.
Desired result using example above is to generate 3 output objects :
Loop value 1 should contain text from rows 1 and 3
Loop value 2 should contain text from rows 2 and 4
Lopp value 3 should contain text from row 5
My code is shown below:
My test spreadsheet contains 5 rows and 2 columns of the form :
ID Text
1 First row for id 1
2 First row for id 2
1 Second row for id 1
2 Second row for id 2
3 First row for id 3
My objective is to use Loop Values to iterate through this data set once for each unique value of ID and only return the result set of rows for that ID.
When I use Loop Values operator and connect to Data to Document operator, I get the text for all 5 rows for each iteration of ID.
When I connect Loop Values to Filter Examples and apply the attribute value filter, I get the text for the rows that match the specified value for each iteration of ID.
What i want is to be able to do is match attribute value with the loop_value, but I don't know how to specify the condition.
Desired result using example above is to generate 3 output objects :
Loop value 1 should contain text from rows 1 and 3
Loop value 2 should contain text from rows 2 and 4
Lopp value 3 should contain text from row 5
My code is shown below:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="5.1.003">
<context>
<input/>
<output/>
<macros/>
</context>
<operator activated="true" class="process" compatibility="5.1.003" expanded="true" name="Process">
<process expanded="true" height="297" width="575">
<operator activated="true" class="read_excel" compatibility="5.1.003" expanded="true" height="60" name="Read Excel" width="90" x="45" y="30">
<parameter key="excel_file" value="C:\Documents and Settings\bjenkins\My Documents\Test Loop.xls"/>
<parameter key="imported_cell_range" value="A1:B6"/>
<parameter key="first_row_as_names" value="false"/>
<list key="annotations">
<parameter key="0" value="Name"/>
</list>
<list key="data_set_meta_data_information">
<parameter key="0" value="ID.true.nominal.id"/>
<parameter key="1" value="Text.true.text.attribute"/>
</list>
</operator>
<operator activated="true" class="loop_values" compatibility="5.1.003" expanded="true" height="76" name="Loop Values" width="90" x="246" y="30">
<parameter key="attribute" value="ID"/>
<process expanded="true" height="315" width="593">
<operator activated="true" class="filter_examples" compatibility="5.1.003" expanded="true" height="76" name="Filter Examples" width="90" x="112" y="75">
<parameter key="condition_class" value="attribute_value_filter"/>
<parameter key="parameter_string" value="ID=3"/>
</operator>
<operator activated="true" class="text:data_to_documents" compatibility="5.1.001" expanded="true" height="60" name="Data to Documents (3)" width="90" x="242" y="31">
<list key="specify_weights"/>
</operator>
<connect from_port="example set" to_op="Filter Examples" to_port="example set input"/>
<connect from_op="Filter Examples" from_port="example set output" to_op="Data to Documents (3)" to_port="example set"/>
<connect from_op="Data to Documents (3)" from_port="documents" to_port="out 1"/>
<portSpacing port="source_example set" spacing="0"/>
<portSpacing port="sink_out 1" spacing="0"/>
<portSpacing port="sink_out 2" spacing="0"/>
</process>
</operator>
<connect from_op="Read Excel" from_port="output" to_op="Loop Values" to_port="example set"/>
<connect from_op="Loop Values" from_port="out 1" 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>
Tagged:
0
Answers
Best, Marius