Due to recent updates, all users are required to create an Altair One account to login to the RapidMiner community. Click the Register button to create your account using the same email that you have previously used to login to the RapidMiner community. This will ensure that any previously created content will be synced to your Altair One account. Once you login, you will be asked to provide a username that identifies you to other Community users. Email us at Community with questions.

"Loop Parameters over a collection of strings"

arc12arc12 Member Posts: 3 Contributor I
edited May 2019 in Help
HI -
I can see how Loop Parameters works to loop over numerical values but I want to set a parameter with a string type.
Specifically, I want to set the URL parameter for the "Read RSS Feed" operation from a list of URLs,

I've experimented, googled and searched these email forums but got nowhere.

Is this possible somehow?

Cheers, Adam

Answers

  • ImageMinerImageMiner Member Posts: 4 Contributor I
    Hi,

    maybe read your urls from a file via "Read Excel" operator. Then make a "Loop Values" over the attribute holding the urls.
    Inside operator "Read RSS" use the macro %{loop_value} as value for "url".
    The name "loop_value" is defined inside the loop operator, so you can use self defined names, too.

    Hope this helps

    ImageMiner
  • arc12arc12 Member Posts: 3 Contributor I
    Thanks imageminer; that was just the info I needed. Simple when you know how!

    For the benefit of others, below is the XML for a how-to-do-it. NB I used the CSV reader, which requires metadata be set. The easiest way to get this right is to use the "wizard". In my case below there was a fist column with entries I discard.

    Cheers, Adam
    ------------------
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.1.004">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="5.1.004" expanded="true" name="Process">
        <process expanded="true" height="325" width="413">
          <operator activated="true" class="read_csv" compatibility="5.1.004" expanded="true" height="60" name="Read CSV" width="90" x="55" y="162">
            <parameter key="csv_file" value="[path to file]/feeds.csv"/>
            <parameter key="column_separators" value=","/>
            <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="type.false.text.attribute"/>
              <parameter key="1" value="url.true.text.attribute"/>
            </list>
          </operator>
          <operator activated="true" class="loop_values" compatibility="5.1.004" expanded="true" height="76" name="Loop Values" width="90" x="246" y="255">
            <parameter key="attribute" value="url"/>
            <process expanded="true" height="593" width="614">
              <operator activated="true" class="web:read_rss" compatibility="5.1.000" expanded="true" height="60" name="Read RSS Feed" width="90" x="112" y="147">
                <parameter key="url" value="%{loop_value}"/>
              </operator>
              <connect from_op="Read RSS Feed" from_port="output" 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 CSV" 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>
Sign In or Register to comment.