Send Example Set to Excel files based on Unique ID

mikedmiked Member Posts: 8 Contributor I
Hi All,
  I'm hoping to once again reach out to the Rapidminer community which has been so helpful. I have created a process where my end result is about 2000 rows which all have a unique ID associated with them. What I'd like to do is be able to write an excel file for each of these unique ID's. Specifically - loop over the process and based on a client ID...create an excel document that only show's that client's data. Excel or PDF would work. Thanks for any help. 
Jasmine_

Best Answers

Answers

  • sgenzersgenzer 12Administrator, Moderator, Employee, RapidMiner Certified Analyst, Community Manager, Member, University Professor, PM Moderator Posts: 2,876  Community Manager
    hi @miked - I'd just do a Loop Examples and a Filter Example Range inside that filters for only that row. Like this:

    <?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="-1"/>
        <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 Iris" width="90" x="45" y="34">
            <parameter key="repository_entry" value="//Samples/data/Iris"/>
          </operator>
          <operator activated="true" class="loop_examples" compatibility="9.6.000" expanded="true" height="82" name="Loop Examples" width="90" x="179" y="34">
            <parameter key="iteration_macro" value="example"/>
            <process expanded="true">
              <operator activated="true" class="filter_example_range" compatibility="9.6.000" expanded="true" height="82" name="Filter Example Range" width="90" x="45" y="34">
                <parameter key="first_example" value="%{example}"/>
                <parameter key="last_example" value="%{example}"/>
                <parameter key="invert_filter" value="false"/>
              </operator>
              <operator activated="true" class="write_excel" compatibility="9.6.000" expanded="true" height="103" name="Write Excel" width="90" x="179" y="34">
                <parameter key="excel_file" value="ROW%{example}"/>
                <parameter key="file_format" value="xlsx"/>
                <enumeration key="sheet_names"/>
                <parameter key="sheet_name" value="RapidMiner Data"/>
                <parameter key="date_format" value="yyyy-MM-dd HH:mm:ss"/>
                <parameter key="number_format" value="#.0"/>
                <parameter key="encoding" value="SYSTEM"/>
              </operator>
              <connect from_port="example set" to_op="Filter Example Range" to_port="example set input"/>
              <connect from_op="Filter Example Range" from_port="example set output" to_op="Write Excel" to_port="input"/>
              <portSpacing port="source_example set" spacing="0"/>
              <portSpacing port="sink_example set" spacing="0"/>
              <portSpacing port="sink_output 1" spacing="0"/>
            </process>
          </operator>
          <connect from_op="Retrieve Iris" from_port="output" to_op="Loop Examples" to_port="example set"/>
          <portSpacing port="source_input 1" spacing="0"/>
          <portSpacing port="sink_result 1" spacing="0"/>
        </process>
      </operator>
    </process>
    



    Scott
    varunm1Jasmine_
  • mikedmiked Member Posts: 8 Contributor I
    Hi Scott,
       That is a big help..thank you. I realize I should've been a bit more clear on what I needed to do so apologies for that. I've attached a sample set of data. Basically each "Dealer_ID" has a set of let's say 4 KPI's. I'd like to be able to have an excel file for each Dealer ID that contains their KPI's. 
    Jasmine_
  • mikedmiked Member Posts: 8 Contributor I
    Hi Scott,
     That's awesome..thanks so much! I see this then puts everything into a collection ...am I then able to write to multiple excel files from there? Right now only one Excel file is being generated. Still a newbie so any help is appreciated. Thanks

    -Mike
  • mikedmiked Member Posts: 8 Contributor I
    @sgenzer
    That did the trick! Thanks for your help!!
    -Mike
    sgenzer
Sign In or Register to comment.