parse a nominal attribute

sebastian_gonza
sebastian_gonza New Altair Community Member
edited November 2024 in Community Q&A

Hi

 

I want to parse the following nominal attribute an example is "01020202_drt234@tg" I want to create 3 colums the first containing what is before the "_" another from the "_" to the "@" and the last one with what remains, I saw a parse from numbers but not from a data type like this, is there an operator for this o how could I do it?

 

Thanks for your help

Best Answer

  • YYH
    YYH
    Altair Employee
    Answer ✓

    Hi @sebastian_gonza,

     

    You can use split operator.

     

    <?xml version="1.0" encoding="UTF-8"?><process version="9.0.002">
    <context>
    <input/>
    <output/>
    <macros/>
    </context>
    <operator activated="true" class="process" compatibility="9.0.002" expanded="true" name="Process">
    <process expanded="true">
    <operator activated="true" class="generate_data_user_specification" compatibility="9.0.002" expanded="true" height="68" name="Generate Data by User Specification" width="90" x="313" y="34">
    <list key="attribute_values">
    <parameter key="input" value="&quot;01020202_drt234@tg&quot;"/>
    </list>
    <list key="set_additional_roles"/>
    </operator>
    <operator activated="true" class="split" compatibility="9.0.002" expanded="true" height="82" name="Split" width="90" x="447" y="34">
    <parameter key="split_pattern" value="_"/>
    </operator>
    <operator activated="true" class="split" compatibility="9.0.002" expanded="true" height="82" name="Split (2)" width="90" x="581" y="34">
    <parameter key="attribute_filter_type" value="single"/>
    <parameter key="attribute" value="input_2"/>
    <parameter key="split_pattern" value="@/&gt;
    </operator>
    <connect from_op="Generate Data by User Specification" from_port="output" to_op="Split" to_port="example set input"/>
    <connect from_op="Split" from_port="example set output" to_op="Split (2)" to_port="example set input"/>
    <connect from_op="Split (2)" from_port="example set output" 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>

    Hope it helps.

     

    YY

Answers

  • YYH
    YYH
    Altair Employee
    Answer ✓

    Hi @sebastian_gonza,

     

    You can use split operator.

     

    <?xml version="1.0" encoding="UTF-8"?><process version="9.0.002">
    <context>
    <input/>
    <output/>
    <macros/>
    </context>
    <operator activated="true" class="process" compatibility="9.0.002" expanded="true" name="Process">
    <process expanded="true">
    <operator activated="true" class="generate_data_user_specification" compatibility="9.0.002" expanded="true" height="68" name="Generate Data by User Specification" width="90" x="313" y="34">
    <list key="attribute_values">
    <parameter key="input" value="&quot;01020202_drt234@tg&quot;"/>
    </list>
    <list key="set_additional_roles"/>
    </operator>
    <operator activated="true" class="split" compatibility="9.0.002" expanded="true" height="82" name="Split" width="90" x="447" y="34">
    <parameter key="split_pattern" value="_"/>
    </operator>
    <operator activated="true" class="split" compatibility="9.0.002" expanded="true" height="82" name="Split (2)" width="90" x="581" y="34">
    <parameter key="attribute_filter_type" value="single"/>
    <parameter key="attribute" value="input_2"/>
    <parameter key="split_pattern" value="@/&gt;
    </operator>
    <connect from_op="Generate Data by User Specification" from_port="output" to_op="Split" to_port="example set input"/>
    <connect from_op="Split" from_port="example set output" to_op="Split (2)" to_port="example set input"/>
    <connect from_op="Split (2)" from_port="example set output" 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>

    Hope it helps.

     

    YY

Welcome!

It looks like you're new here. Sign in or register to get started.

Welcome!

It looks like you're new here. Sign in or register to get started.