Options

Easiest way to remove "count" in front of attribute name

jhiKljhiKl Member Posts: 12 Contributor I
Hello! is there a way where I can remove the word count in front of the name of the attribute all at once?
What I have is a lot of
attribute name : count (prod_name)_sunglasses

What I would like to have
attribute name: sunglasses

Best Answers

Answers

  • Options
    jhiKljhiKl Member Posts: 12 Contributor I
    edited March 2020
    hello thank you for responding quickly, how do I replace just a part of the column name? I tried rename by replacing operator but it doesn't work
  • Options
    hbajpaihbajpai Member Posts: 102 Unicorn
    If that part is consistent (For example: count) and does not have any special characters. You can substitute it by using replace what as count and leave replace by blank in the operator. Otherwise you can use regex formatting to replace.

    If you can share your XML I quickly try and send you updates process.
    Best,
    Harshit
  • Options
    jhiKljhiKl Member Posts: 12 Contributor I
    <?xml version="1.0" encoding="UTF-8"?><process version="9.6.000">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="9.6.000" 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="retrieve" compatibility="9.6.000" expanded="true" height="68" name="Retrieve JANMarketAnalysis1997" width="90" x="45" y="187">
            <parameter key="repository_entry" value="//IS210 Case Analysis/data/JANMarketAnalysis1997"/>
          </operator>
          <operator activated="true" class="rename_by_replacing" compatibility="9.6.000" expanded="true" height="82" name="Rename by Replacing" width="90" x="179" y="187">
            <parameter key="attribute_filter_type" value="subset"/>
            <parameter key="attribute" value=""/>
            <parameter key="attributes" value=""/>
            <parameter key="use_except_expression" value="false"/>
            <parameter key="value_type" value="attribute_value"/>
            <parameter key="use_value_type_exception" value="false"/>
            <parameter key="except_value_type" value="time"/>
            <parameter key="block_type" value="attribute_block"/>
            <parameter key="use_block_type_exception" value="false"/>
            <parameter key="except_block_type" value="value_matrix_row_start"/>
            <parameter key="invert_selection" value="false"/>
            <parameter key="include_special_attributes" value="false"/>
            <parameter key="replace_what" value="\W"/>
          </operator>
          <connect from_op="Retrieve JANMarketAnalysis1997" from_port="output" to_op="Rename by Replacing" to_port="example set input"/>
          <connect from_op="Rename by Replacing" 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>


  • Options
    jhiKljhiKl Member Posts: 12 Contributor I
    I don't know if this is the xml that you need, but hopefully it is. Do you know how to regex the "count(product_name)_" i'm still looking for the regex that shows the "exact match".
  • Options
    jhiKljhiKl Member Posts: 12 Contributor I
    edited April 2020
    Hello, I was able to do it thanks to you guys!

    Appreciatively,
    jhiKl
  • Options
    mantanzmantanz Member Posts: 8 Contributor II
    In case the complete text count(product_name)_ needs to match exact, then regex will be count\(product_name\)_
Sign In or Register to comment.