🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

How to output JSON from "Execute Script"?

User: "Ziggizag"
New Altair Community Member
Updated by Jocelyn
I have a script producing a JSON output.

Unfortunately, this output seems to be "class java.lang.String" rather than "document", so it is not consumed by other operators.

The question is - how to properly return a "document" object containing e.g. following JSON:

{item_id: {$in: [36, 39]}}

This should be used as EVD (Read MongoDB) operator criteria input.

Can you help, please?






Find more posts tagged with

Sort by:
1 - 1 of 11
    User: "jwpfau"
    Altair Employee
    Hi,

    you mean like this?

    <?xml version="1.0" encoding="UTF-8"?><process version="10.3.001">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="10.3.001" expanded="true" name="Process">
        <parameter key="logverbosity" value="init"/>
        <parameter key="random_seed" value="2001"/>
        <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="execute_script" compatibility="10.3.001" expanded="true" height="82" name="Execute Script" width="90" x="45" y="34">
            <parameter key="script" value="return new com.rapidminer.operator.text.Document(&quot;{item_id: {\$in: [36, 39]}}&quot;)"/>
            <parameter key="standard_imports" value="true"/>
          </operator>
          <connect from_op="Execute Script" from_port="output 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>