9 Replies Latest reply: Sep 30, 2013 10:40 AM by Paul Madden RSS

    Multiple Filter Rules

    Paul Madden

      According to the Expressor documentation, a Filter Operator can have up to 10 Rules.  However, when I create a Filter one Rule is created by default, and the "New Rule" button is grayed out.  I can convert the default Rule to a Function Rule, but I can't convert it back; and I still cannot add more than the one Rule.

       

      I would like to setup my filter so it sends records to the output if:

       

      Input.Field1 == 1

      OR

      Is.Empty(Input.Field2)

      OR

      Is.Empty(Input.Field3)

       

      I suppose I can put multiple Filters in for each rule... but I'd rather keep the dataflow as clean as possible.

       

      Any thoughts?  Thanks in advance!

        • Re: Multiple Filter Rules
          Juan Gerardo Cabeza Luque

          With the Filter object you have one rule per output, and everything that evaluates true is moved to this output. You can have new rules as you add new outputs, but you have to define all the conditions for every output in its correspondent rule.

           

          I think the button New Rule is there because it is in the rules editor used in more operators, but it is grayed because you must add the rules adding outputs.

           

          JG

          • Re: Multiple Filter Rules

            Juan's response is correct.  The New Rule button is not operative with the Filter operator.  To add additional output ports you click the Add Port button in the Output Ports grouping.

             

            Once you have created multiple output ports, you can specify whether each incoming record will be emitted on all ports for which the corresponding conditional statement returns true, or only on the first port for which the statement is true.

             

            For the use case you describe, you can put the entire statement into a single rule.  There would be no need to set up a second and third rule.  Simply add all three attributes as incoming rule parameters to a single rule and enter your statement.