2013-04-15 55 views

回答

2

有一个运算符Loop files,您可以使用它来遍历文件目录。在该运算符的子进程中使用Read Excel运算符。这样的结果是ExampleSets的集合。处理一组示例集有多种方法。对于连接(要生成一个ExampleSet),请使用Append运算符。

下面是一个示例过程的xml:

<?xml version="1.0" encoding="UTF-8" standalone="no"?> 
<process version="5.3.007"> 
    <context> 
    <input/> 
    <output/> 
    <macros/> 
    </context> 
    <operator activated="true" class="process" compatibility="5.3.007" expanded="true" name="Process"> 
    <process expanded="true"> 
     <operator activated="true" class="loop_files" compatibility="5.3.007" expanded="true" height="76" name="Loop Files" width="90" x="782" y="30"> 
     <parameter key="directory" value="D:\xls"/> 
     <parameter key="filter" value="^.*\.xlsx?$"/> 
     <process expanded="true"> 
      <operator activated="true" class="read_excel" compatibility="5.3.007" expanded="true" height="60" name="Read Excel" width="90" x="782" y="30"> 
      <parameter key="excel_file" value="%{file_path}"/> 
      <list key="annotations"/> 
      <list key="data_set_meta_data_information"/> 
      </operator> 
      <connect from_op="Read Excel" 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> 
     <operator activated="true" class="append" compatibility="5.3.007" expanded="true" height="76" name="Append" width="90" x="916" y="30"/> 
     <connect from_op="Loop Files" from_port="out 1" to_op="Append" to_port="example set 1"/> 
     <connect from_op="Append" from_port="merged 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> 
相关问题