Options

how to calculate count of column value and store in macro

sgnarkhede2016sgnarkhede2016 Member Posts: 152 Contributor II
edited March 2020 in Help

id          attr1
 
a1        Account Number
a2        Customer Id
 a3       Customer Type

I want to store count of attr1 or id column count in "number_of_paraeter" macro (3)
both attribute datatype is nominal


<?xml version="1.0" encoding="UTF-8"?><process version="9.5.001">
  <context>
    <input/>
    <output/>
    <macros/>
  </context>
  <operator activated="true" class="process" compatibility="9.5.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="false" class="retrieve" compatibility="9.5.001" expanded="true" height="68" name="Retrieve BusinessProf_Config" width="90" x="45" y="289">
        <parameter key="repository_entry" value="//RM-9/home/admin/Pelican/778580_Al-ansari Scenarios_06032020/Transaction Monitoring/Data/BusinessProf_Config"/>
      </operator>
      <operator activated="true" class="retrieve" compatibility="9.5.001" expanded="true" height="68" name="Retrieve BusinessProf_Config (2)" width="90" x="45" y="34">
        <parameter key="repository_entry" value="../Data/BusinessProf_Config"/>
      </operator>
      <operator activated="false" breakpoints="after" class="transpose" compatibility="9.5.001" expanded="true" height="82" name="Transpose (2)" width="90" x="246" y="289"/>
      <operator activated="true" class="filter_examples" compatibility="9.5.001" expanded="true" height="103" name="Filter Examples (3)" width="90" x="179" y="34">
        <parameter key="parameter_expression" value=""/>
        <parameter key="condition_class" value="custom_filters"/>
        <parameter key="invert_filter" value="false"/>
        <list key="filters_list">
          <parameter key="filters_entry_key" value="ENABLE.equals.Yes"/>
        </list>
        <parameter key="filters_logic_and" value="true"/>
        <parameter key="filters_check_metadata" value="true"/>
      </operator>
      <operator activated="true" class="concurrency:loop" compatibility="9.5.001" expanded="true" height="82" name="Loop" width="90" x="380" y="136">
        <parameter key="number_of_iterations" value="5"/>
        <parameter key="iteration_macro" value="iteration"/>
        <parameter key="reuse_results" value="false"/>
        <parameter key="enable_parallel_execution" value="true"/>
        <process expanded="true">
          <operator activated="true" class="filter_example_range" compatibility="9.5.001" expanded="true" height="82" name="Filter Example Range" width="90" x="45" y="34">
            <parameter key="first_example" value="%{iteration}"/>
            <parameter key="last_example" value="%{iteration}"/>
            <parameter key="invert_filter" value="false"/>
          </operator>
          <operator activated="true" class="transpose" compatibility="9.5.001" expanded="true" height="82" name="Transpose" width="90" x="179" y="34"/>
          <operator activated="true" breakpoints="after" class="filter_examples" compatibility="9.5.001" expanded="true" height="103" name="Filter Examples" width="90" x="313" y="34">
            <parameter key="parameter_expression" value=""/>
            <parameter key="condition_class" value="custom_filters"/>
            <parameter key="invert_filter" value="false"/>
            <list key="filters_list">
              <parameter key="filters_entry_key" value="att_1.is_not_missing."/>
              <parameter key="filters_entry_key" value="id.does_not_equal.ENABLE"/>
            </list>
            <parameter key="filters_logic_and" value="true"/>
            <parameter key="filters_check_metadata" value="true"/>
          </operator>
          <operator activated="true" class="extract_macro" compatibility="9.5.001" expanded="true" height="68" name="Extract Macro (2)" width="90" x="514" y="34">
            <parameter key="macro" value="number_of_parameters"/>
            <parameter key="macro_type" value="statistics"/>
            <parameter key="statistics" value="count"/>
            <parameter key="attribute_name" value="attr1"/>
            <parameter key="attribute_value" value="1"/>
            <list key="additional_macros"/>
          </operator>
          <operator activated="false" breakpoints="after" class="parse_numbers" compatibility="9.5.001" expanded="true" height="82" name="Parse Numbers" width="90" x="380" y="187">
            <parameter key="attribute_filter_type" value="all"/>
            <parameter key="attribute" value="id"/>
            <parameter key="attributes" value=""/>
            <parameter key="use_except_expression" value="false"/>
            <parameter key="value_type" value="nominal"/>
            <parameter key="use_value_type_exception" value="false"/>
            <parameter key="except_value_type" value="file_path"/>
            <parameter key="block_type" value="single_value"/>
            <parameter key="use_block_type_exception" value="false"/>
            <parameter key="except_block_type" value="single_value"/>
            <parameter key="invert_selection" value="false"/>
            <parameter key="include_special_attributes" value="false"/>
            <parameter key="decimal_character" value="."/>
            <parameter key="grouped_digits" value="false"/>
            <parameter key="grouping_character" value=","/>
            <parameter key="infinity_representation" value=""/>
            <parameter key="unparsable_value_handling" value="fail"/>
          </operator>
          <operator activated="false" breakpoints="after" class="concurrency:loop_values" compatibility="9.5.001" expanded="true" height="82" name="Loop Values" width="90" x="648" y="136">
            <parameter key="attribute" value="id"/>
            <parameter key="iteration_macro" value="loop_value"/>
            <parameter key="reuse_results" value="false"/>
            <parameter key="enable_parallel_execution" value="true"/>
            <process expanded="true">
              <operator activated="true" class="filter_examples" compatibility="9.5.001" expanded="true" height="103" name="Filter Examples (2)" width="90" x="45" y="34">
                <parameter key="parameter_expression" value="id==%{loop_value}"/>
                <parameter key="condition_class" value="expression"/>
                <parameter key="invert_filter" value="false"/>
                <list key="filters_list"/>
                <parameter key="filters_logic_and" value="true"/>
                <parameter key="filters_check_metadata" value="true"/>
              </operator>
              <operator activated="true" class="extract_macro" compatibility="9.5.001" expanded="true" height="68" name="Extract Macro" width="90" x="179" y="34">
                <parameter key="macro" value="key_attribute_%{loop_value}"/>
                <parameter key="macro_type" value="statistics"/>
                <parameter key="statistics" value="average"/>
                <parameter key="attribute_name" value="atr1"/>
                <parameter key="example_index" value="1"/>
                <list key="additional_macros"/>
              </operator>
              <connect from_port="input 1" to_op="Filter Examples (2)" to_port="example set input"/>
              <connect from_op="Filter Examples (2)" from_port="example set output" to_op="Extract Macro" to_port="example set"/>
              <connect from_op="Extract Macro" from_port="example set" to_port="output 1"/>
              <portSpacing port="source_input 1" spacing="0"/>
              <portSpacing port="source_input 2" spacing="0"/>
              <portSpacing port="sink_output 1" spacing="0"/>
              <portSpacing port="sink_output 2" spacing="0"/>
            </process>
          </operator>
          <operator activated="false" class="append" compatibility="9.5.001" expanded="true" height="68" name="Append" width="90" x="581" y="238">
            <parameter key="datamanagement" value="double_array"/>
            <parameter key="data_management" value="auto"/>
            <parameter key="merge_type" value="all"/>
          </operator>
          <operator activated="false" class="operator_toolbox:group_into_collection" compatibility="2.1.000" expanded="true" height="82" name="Group Into Collection" width="90" x="715" y="238">
            <parameter key="group_by_attribute" value="att_1"/>
            <parameter key="group_by_attribute (numerical)" value=""/>
            <parameter key="sorting_order" value="none"/>
          </operator>
          <operator activated="false" breakpoints="after" class="nominal_to_numerical" compatibility="9.5.001" expanded="true" height="103" name="Nominal to Numerical" width="90" x="380" y="187">
            <parameter key="return_preprocessing_model" value="false"/>
            <parameter key="create_view" value="false"/>
            <parameter key="attribute_filter_type" value="single"/>
            <parameter key="attribute" value="id"/>
            <parameter key="attributes" value=""/>
            <parameter key="use_except_expression" value="false"/>
            <parameter key="value_type" value="nominal"/>
            <parameter key="use_value_type_exception" value="false"/>
            <parameter key="except_value_type" value="file_path"/>
            <parameter key="block_type" value="single_value"/>
            <parameter key="use_block_type_exception" value="false"/>
            <parameter key="except_block_type" value="single_value"/>
            <parameter key="invert_selection" value="false"/>
            <parameter key="include_special_attributes" value="false"/>
            <parameter key="coding_type" value="unique integers"/>
            <parameter key="use_comparison_groups" value="false"/>
            <list key="comparison_groups"/>
            <parameter key="unexpected_value_handling" value="all 0 and warning"/>
            <parameter key="use_underscore_in_name" value="false"/>
          </operator>
          <connect from_port="input 1" to_op="Filter Example Range" to_port="example set input"/>
          <connect from_op="Filter Example Range" from_port="example set output" to_op="Transpose" to_port="example set input"/>
          <connect from_op="Transpose" from_port="example set output" to_op="Filter Examples" to_port="example set input"/>
          <connect from_op="Filter Examples" from_port="example set output" to_op="Extract Macro (2)" to_port="example set"/>
          <connect from_op="Append" from_port="merged set" to_op="Group Into Collection" to_port="exa"/>
          <portSpacing port="source_input 1" spacing="0"/>
          <portSpacing port="source_input 2" spacing="0"/>
          <portSpacing port="sink_output 1" spacing="0"/>
        </process>
      </operator>
      <connect from_op="Retrieve BusinessProf_Config (2)" from_port="output" to_op="Filter Examples (3)" to_port="example set input"/>
      <connect from_op="Filter Examples (3)" from_port="example set output" to_op="Loop" to_port="input 1"/>
      <portSpacing port="source_input 1" spacing="0"/>
      <portSpacing port="sink_result 1" spacing="0"/>
    </process>
  </operator>
</process>

Tagged:

Best Answer

  • Options
    sgnarkhede2016sgnarkhede2016 Member Posts: 152 Contributor II
    Solution Accepted
    Using extract macro i solved above issue
Sign In or Register to comment.