Between filter for ETL

      Between filter for ETL

      Hi All.

      I need to create a complex ETL and one of my filter needs is to select only those rows from a transformation whose a column value is between two others, I have created a TableView transform but the only available operators are "equal", "inRange", etc and it doesn't allow me to compare two columns from the transformation.

      Is there any way to do this?

      Thanks in advance, regards.
      Hi,

      If the conditions can be read from the same row then you can use FieldTransform to do the checking. For example using Groovy transform to set the flag for further filtering:

      Input: Condition1_Field
      Input: Condition2_Field

      Script:
      if (_input1=3 and _input2>5){
      return 'YES'
      } else {
      return 'NO'
      }

      This will return 'YES' if your Condition1=3 and Condition2>5, otherwise 'NO'. You can then redirect the output to TableView and filter out any 'NO' records.

      Hope this helps,
      Madis

      Madis wrote:

      if (_input1=3 and _input2>5){
      return 'YES'
      } else {
      return 'NO'
      }


      mmm, sorry but it does not look very much groovy-syntax compliant

      Source Code

      1. if (_input1==3 && _input2>5)
      2. {
      3. return 'YES'
      4. }
      5. else
      6. {
      7. return 'NO'
      8. }


      with ternary condition:

      Source Code

      1. return ( (_input1==3) && (_input2>5) )?'yes':'no';
      laloune

      Post hoc, non est propter hoc