Hitachi Vantara Pentaho Community Forums
Results 1 to 5 of 5

Thread: Reset field when "Group field" changes

  1. #1

    Default Reset field when "Group field" changes

    Hello,

    I have to create a field called "Flag" that resets each time a value in an specific field changes. In the example below, the field "Flag" changes from 1 to 0 or from 0 to 1 every time the field "Group_Field" changes. I have tried to do this with the "Add value fields changing sequence" step but the problem with this step is that every time the sequence number is reset is starts at 1. Can anyone help me to do this?

    Thanks in advance.

    Group_Field Flag
    Group 1 1
    Group 1 1
    Group 2
    0
    Group 2
    0
    Group 2 0
    Group 3 1
    Group 4
    0
    Group 5 1
    Group 5 1
    Group 6
    0

  2. #2
    Join Date
    Aug 2016
    Posts
    289

    Default

    This kind of logic is super easy to handle in java.

  3. #3
    Join Date
    May 2016
    Posts
    280

    Default

    OS: Ubuntu 16.04 64 bits
    Java: Openjdk 1.8.0_131
    Pentaho 6.1 CE

  4. #4

    Default

    Quote Originally Posted by Sparkles View Post
    This kind of logic is super easy to handle in java.
    Thanks for the answer. Can you please provide an example on how to approach this in Java?

    If I were able to access to the value of field "Flag" in the previous row, I think it would be quite straightforward.

    Thanks!!!

  5. #5
    Join Date
    Nov 2009
    Posts
    688

    Default

    With the step "Analytic Query" you can get the value of a field from a previous record

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.