How Retrive And Store Attribute Names

Diego_PeroniDiego_Peroni Member Posts: 1 Contributor I
edited November 2018 in Help
Hi All,

I'm trying to loop over attributes using "Loop Attributes" and I need to Store Attribute Name whose value is higher than others in the new Attribute "target_stock_name".
Using %{loop_attribute} variable inside loop I can obtain just current attribute value, but NOT the relative name that I need to store.

Thanks for your help

Diego

That's my incomplete code:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="5.3.008">
 <context>
   <input/>
   <output/>
   <macros/>
 </context>
 <operator activated="true" class="process" compatibility="5.3.008" expanded="true" name="Process">
   <parameter key="logfile" value="right_stock"/>
   <process expanded="true">
     <operator activated="true" class="retrieve" compatibility="5.3.008" expanded="true" height="60" name="Retrieve dataset_analisi_6_days" width="90" x="45" y="75">
       <parameter key="repository_entry" value="dati/dataset_analisi_6_days"/>
     </operator>
     <operator activated="true" class="generate_attributes" compatibility="5.3.008" expanded="true" height="76" name="Generate Attributes (4)" width="90" x="246" y="255">
       <list key="function_descriptions">
         <parameter key="target_stock_name" value="0"/>
       </list>
     </operator>
     <operator activated="true" class="loop_attributes" compatibility="5.3.008" expanded="true" height="76" name="Loop Attributes" width="90" x="447" y="345">
       <parameter key="attribute_filter_type" value="regular_expression"/>
       <parameter key="regular_expression" value="(\w+)_days"/>
       <process expanded="true">
         <operator activated="true" class="generate_attributes" compatibility="5.3.008" expanded="true" height="76" name="Generate Attributes (3)" width="90" x="380" y="120">
           <list key="function_descriptions">
             <parameter key="target_stock_name" value="if (abs(target_stock_name)&lt;abs(%{loop_attribute}),abs(%{loop_attribute}),target_stock_name)"/>
           </list>
         </operator>
         <connect from_port="example set" to_op="Generate Attributes (3)" to_port="example set input"/>
         <connect from_op="Generate Attributes (3)" from_port="example set output" to_port="example set"/>
         <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="Retrieve dataset_analisi_6_days" from_port="output" to_op="Generate Attributes (4)" to_port="example set input"/>
     <connect from_op="Generate Attributes (4)" from_port="example set 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>
This is my dataset

2.0 Fri Jun 28 00:00:00 CEST 2013 -5.301379127862274 1.2084340438962673 3.756473280984599 -0.8406670274689139 -1.0402774782574085
3.0 Thu Jun 27 00:00:00 CEST 2013 -4.931415613682149 1.9861881612790098 3.7068964427360145 -0.4616331337735309 -0.5720813696350834
4.0 Wed Jun 26 00:00:00 CEST 2013 -4.347146159983026 2.253453972678085 3.5840255083307064 0.6913113883833237 -1.341390748161822
5.0 Tue Jun 25 00:00:00 CEST 2013 -3.1930516634638124 1.6440944776506343 4.8125572406078225 1.5274533068198364 -2.1368415548254363
6.0 Mon Jun 24 00:00:00 CEST 2013 -2.999037533422286 2.3463132008097873 4.918337576823321 2.984217415519977 -5.082876593344721
7.0 Fri Jun 21 00:00:00 CEST 2013 -2.0394452019608176 2.3654505917527366 6.588339866717364 3.6911094018474047 -1.2923070757421375
8.0 Thu Jun 20 00:00:00 CEST 2013 -2.469456734828675 1.806992596012614 1.6798165790487665 2.5931849878502153 -0.9114063655121569
9.0 Wed Jun 19 00:00:00 CEST 2013 -3.477967705037697 1.1430834564749548 1.0513804334192234 2.244034347043521 -0.6804159652456553
10.0 Tue Jun 18 00:00:00 CEST 2013 -1.8608707889148755 0.06273612350205515 -0.7107409043866321 0.947844625134816 -0.49667926456006095
11.0 Mon Jun 17 00:00:00 CEST 2013 -1.6875069332383328 1.0303110279149261 3.7488592911346643 1.300082836313611 -1.277028872619797
12.0 Fri Jun 14 00:00:00 CEST 2013 -1.775624051216746 2.5211834050969246 3.08847878040992 1.365286243637159 0.501408562624484
13.0 Thu Jun 13 00:00:00 CEST 2013 -3.0583533785907493 2.275410737307521 2.6744665873953473 1.017917562605692 1.4836363561360046
14.0 Wed Jun 12 00:00:00 CEST 2013 -2.2986811025736515 3.880017830262954 2.770337159492497 3.0799541666770622 0.2554187358167266
15.0 Tue Jun 11 00:00:00 CEST 2013 -2.0129650203614275 3.9319461246333804 1.8392006614176641 2.3490411066984844 1.0568861149974214
16.0 Mon Jun 10 00:00:00 CEST 2013 -2.671777738369806 4.136256140944963 -0.15306436681149993 1.9348238577367995 1.498840913327203
17.0 Fri Jun 07 00:00:00 CEST 2013 -1.4585342920289954 4.468171191279621 -4.476159045880787 1.7556767737716865 3.4550363890559157
18.0 Thu Jun 06 00:00:00 CEST 2013 0.10433461232862884 2.4195623755711746 0.23788820688430246 1.1296787382430966 3.1401087905394816
19.0 Wed Jun 05 00:00:00 CEST 2013 3.353151562448566 2.4735186597357 -2.349232667896485 0.04390561842265783 1.3158369579627405
20.0 Tue Jun 04 00:00:00 CEST 2013 1.499034891820206 2.0854562227555284 -2.538194269858044 -1.0708474055435644 0.31525574397607103
21.0 Mon Jun 03 00:00:00 CEST 2013 2.0292540758569695 2.0412907872130774 -4.609051521189405 -1.623838197399299 1.5358643586203957
22.0 Fri May 31 00:00:00 CEST 2013 2.395359253489672 2.869006541210903 -2.5419574112349306 -1.550395875759469 -0.35861296497478645
23.0 Thu May 30 00:00:00 CEST 2013 3.1459650491551896 -0.2569074916856471 -3.714859419365973 -3.5812654106439483 -1.9916356110519953
24.0 Wed May 29 00:00:00 CEST 2013 1.340136735913576 0.13558776569315167 -8.951141258560439 -3.6126362579706632 -2.0037307571684417
25.0 Tue May 28 00:00:00 CEST 2013 2.451070892617599 -0.37263226345129374 -7.910731561556904 -2.539152964557658 -1.1058001272533429
26.0 Fri May 24 00:00:00 CEST 2013 2.6704966168871946 -0.6156010290588305 -6.888396450552475 -3.1729414726808964 -0.6550101226193665
27.0 Thu May 23 00:00:00 CEST 2013 3.3795154802490277 -1.4539153614398994 -5.618339006755232 -3.3584572867191245 -4.572077606751037
28.0 Wed May 22 00:00:00 CEST 2013 -0.6138562075376441 -2.1060055728695053 -7.394667448400025 0.19879228036312613 -0.41872969133454774
29.0 Tue May 21 00:00:00 CEST 2013 -4.787813034052432 0.13654175578524097 -5.906155190319422 1.828284556423968 0.8362194269355693
30.0 Mon May 20 00:00:00 CEST 2013 -3.6741650806085175 -0.004618856907882329 -5.012457910558189 1.6778804460165029 -2.399243328510063
31.0 Fri May 17 00:00:00 CEST 2013 -7.496885099319913 1.411352666043208 -5.232217973393283 1.9945372390262293 -1.1358873692110865
32.0 Thu May 16 00:00:00 CEST 2013 -7.610683560505638 0.9022402184266572 -4.879294166490386 2.268115077176643 -0.44669799683208833
33.0 Wed May 15 00:00:00 CEST 2013 -8.408815870817989 1.5939241470088736 -2.8455745333717952 4.901353563820071 3.045007837413957
34.0 Tue May 14 00:00:00 CEST 2013 -5.213243697314095 3.2988503595095633 -3.3201365896074453 1.4138000616496722 4.252340283603744
35.0 Mon May 13 00:00:00 CEST 2013 -0.3048075695771768 1.0830544915596834 -6.73832426867869 2.326326674372932 3.835204603104017
Sign In or Register to comment.