"Anyone please? Loop Attributes? -
MacPhotoBiker
New Altair Community Member
Hi,
I'm trying to identify the first three orders when a particular customer purchased a particular product. The "integrate" operator could help to put a counter in each record, but I don't know how to reset it based on certain conditions (like "New customer and new article"). Here's what I try to achieve:
I'm hoping somebody could point me in the right direction.
Thank you!
I'm trying to identify the first three orders when a particular customer purchased a particular product. The "integrate" operator could help to put a counter in each record, but I don't know how to reset it based on certain conditions (like "New customer and new article"). Here's what I try to achieve:
Customer | Article | Counter |
C1 | A1 | 1 |
C1 | A1 | 2 |
C1 | A1 | 3 |
C1 | A2 | 1 |
C1 | A2 | 2 |
C2 | A1 | 1 |
C2 | A2 | 1 |
I'm hoping somebody could point me in the right direction.
Thank you!
Tagged:
0
Answers
-
The most promising operator seems to be the "Loop Operator".
Here's how my table looks like currently:
I want the operator to integrate "Counter" for every different Customer-Article combination. After the operator, the table should look like this:Customer Article Counter C1 A1 1 C1 A1 1 C1 A1 1 C1 A2 1 C1 A2 1 C2 A1 1 C2 A2 1
The best I came up with is this process, but it's not working:Customer Article Counter C1 A1 1 C1 A1 2 C1 A1 3 C1 A2 1 C1 A2 2 C2 A1 1 C2 A2 1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
And here's the data as csv:
<process version="5.3.013">
<context>
<input/>
<output/>
<macros/>
</context>
<operator activated="true" class="process" compatibility="5.3.013" expanded="true" name="Process">
<process expanded="true">
<operator activated="true" class="read_csv" compatibility="5.3.013" expanded="true" height="60" name="Read CSV" width="90" x="112" y="75">
<parameter key="csv_file" value="/home/gert/Desktop/loop_table.csv"/>
<parameter key="column_separators" value=","/>
<parameter key="first_row_as_names" value="false"/>
<list key="annotations">
<parameter key="0" value="Name"/>
</list>
<parameter key="encoding" value="UTF-8"/>
<list key="data_set_meta_data_information">
<parameter key="0" value="Customer.true.polynominal.attribute"/>
<parameter key="1" value="Article.true.polynominal.attribute"/>
<parameter key="2" value="Counter.true.integer.attribute"/>
</list>
</operator>
<operator activated="true" class="loop_attributes" compatibility="5.3.013" expanded="true" height="76" name="Loop Attributes" width="90" x="380" y="75">
<parameter key="attribute_filter_type" value="subset"/>
<parameter key="attribute" value="Article"/>
<parameter key="attributes" value="Article|Customer|"/>
<process expanded="true">
<operator activated="true" class="series:integrate_series" compatibility="5.3.000" expanded="true" height="76" name="Integrate" width="90" x="313" y="120">
<parameter key="attribute_name" value="Counter"/>
</operator>
<connect from_port="example set" to_op="Integrate" to_port="example set input"/>
<portSpacing port="source_example set" spacing="0"/>
<portSpacing port="sink_example set" spacing="0"/>
<portSpacing port="sink_result 1" spacing="0"/>
</process>
</operator>
<connect from_op="Read CSV" from_port="output" to_op="Loop Attributes" to_port="example set"/>
<connect from_op="Loop Attributes" from_port="example set" 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>
Customer,Article,Counter
C1,A1,1
C1,A1,1
C1,A1,1
C1,A2,1
C1,A2,1
C2,A1,1
C2,A2,1
C3,A3,1
I'd really appreciate somebody could help me out.
Thanks a lot in advance!0