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

"Loop files filter"

GregMGregM Member Posts: 18 Maven
edited June 2019 in Help
I have a folder with several csv files...    along with some other files.  What I want to do is loop through only the files that match the following case insensitive filter:

bdo*26*.csv

I can not figure out how to get any filter working.  The code below is what I am trying to run just to verify funcitonality and right now I am not even able to filter just csv files.  if I leave the filter blank it reads in all the files (including those I don't want). so the read is apparently working.  what am I doing wrong in the filter?


any help is appreciated, thanks
Greg
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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="loop_files" compatibility="5.3.013" expanded="true" height="76" name="Loop Files" width="90" x="179" y="120">
        <parameter key="directory" value="C:\Users\greg.mcfadden\Desktop\Allen\temp"/>
        <parameter key="filter" value="=*.csv"/>
        <process expanded="true">
          <operator activated="true" class="read_csv" compatibility="5.3.013" expanded="true" height="60" name="Read CSV" width="90" x="246" y="255">
            <parameter key="column_separators" value=","/>
            <list key="annotations"/>
            <list key="data_set_meta_data_information">
              <parameter key="1" value="a.true.nominal.regular"/>
              <parameter key="2" value="b.true.nominal.regular"/>
              <parameter key="3" value="c.true.nominal.regular"/>
              <parameter key="4" value="d.true.nominal.regular"/>
            </list>
          </operator>
          <connect from_port="file object" to_op="Read CSV" to_port="file"/>
          <connect from_op="Read CSV" from_port="output" to_port="out 1"/>
          <portSpacing port="source_file object" spacing="0"/>
          <portSpacing port="source_in 1" spacing="0"/>
          <portSpacing port="sink_out 1" spacing="0"/>
          <portSpacing port="sink_out 2" spacing="0"/>
        </process>
      </operator>
      <connect from_op="Loop Files" 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>

Answers

  • awchisholmawchisholm RapidMiner Certified Expert, Member Posts: 458 Unicorn
    Hello Greg

    Regular expressions - tough at first - then with practice they remain tough.

    Without trying it, I can't be 100% certain but I think this requirement

    bdo*26*.csv

    could be implemented with the following in the filter

    [Bb]do.*26.*\.csv

    If you click on the little icon to the right of the filter dialog, a regular expression helper window comes up that is very good. Type the regular expression in the top field and the possible file name in the third field labelled text. If the regular expression matches, the text will be highlighted.

    regards

    Andrew

    regards

    Andrew
  • GregMGregM Member Posts: 18 Maven
    thanks but no luck...  

    .*csv finds the csv files
    b.* finds nothing even though there are plenty of files in the directory with names beginning with b

    oddly enough a reboot of the computer and rapidminer and it seems to be working...  thanks!
Sign In or Register to comment.