%{process_name} as filename in store operator

ml1n
ml1n New Altair Community Member
edited November 5 in Community Q&A
Hello,
I'm trying to use the macro %{process_name}_results as the file name for the store operator but the object saved in the repository ends up being called process_name_results, which is not what I'd expected.
How do I set the object name to be the same as the process name?

The operator setup looks like this:
      <operator activated="true" class="store" compatibility="5.1.001" expanded="true" height="60" name="Store" width="90" x="380" y="300">
        <parameter key="repository_entry" value="%{process_name}_results"/>
      </operator>

Any help gratefully recieved.
M.
Tagged:

Answers

  • steffen
    steffen New Altair Community Member
    Hi ml1n

    and welcome to rapidminer (at least it is your first post ;)).

    The correct name of the macro is: process_file, hence

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.1.001">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="5.1.001" expanded="true" name="Process">
        <process expanded="true" height="370" width="614">
          <operator activated="true" class="retrieve" compatibility="5.1.001" expanded="true" height="60" name="Retrieve" width="90" x="112" y="120">
            <parameter key="repository_entry" value="//Samples/data/Iris"/>
          </operator>
          <operator activated="true" class="store" compatibility="5.1.001" expanded="true" height="60" name="Store" width="90" x="311" y="347">
            <parameter key="repository_entry" value="%{process_file}_result"/>
          </operator>
          <connect from_op="Retrieve" from_port="output" to_op="Store" to_port="input"/>
          <portSpacing port="source_input 1" spacing="0"/>
          <portSpacing port="sink_result 1" spacing="0"/>
        </process>
      </operator>
    </process>
    worked for me. I can only guess that this is a bug.

    @developers: From MacroHandler#getMacro

    case PROCESS_NAME:
    String fileName = process.getProcessLocation().getShortName();
    return fileName.substring(0, fileName.lastIndexOf("."))
    This snippets work only if the process-name contains an ending. If one add a artificial ending when saving a process, it works. Otherwise not (I have tested it).

    hope this was helpful,

    steffen
  • ml1n
    ml1n New Altair Community Member
    Hi Steffen,
    Thanks for the welcome. I am new to Rapidminer but I'm really impressed with how quickly it let me get up and running.

    That works for me. I didn't find anything in the bug tracker related to that macro. Should I raise one?

    M.
  • steffen
    steffen New Altair Community Member
    Hello ml1n

    yeah, sure. First I wanted to wait for a developer statement, but since they are rather busy it is no mistake to open a ticket. They can still close it as "work as intended" ;).

    I suggest to add a link to this thread.

    thank you,

    steffen