We recommend switching to the latest versions of Edge, Firefox, Chrome or Safari. Using Internet Explorer will result in a loss of website functionality.

How to shift record of one field above or below

Comments

3 comments

  • Avatar
    Adrian Williams

    Please see the attached example data flow.

    The 'Shift_Forward_Field' Transform node shifts the values of the specified 'fieldToShift' field ("color" in this case) forward by one index position relative to the rest of the fields in the record. If the 'fillValue' variable is not Null, the value is used in the first output record else the value output will be Null.

    The Shift_Back_Field Transform node shifts the values of the specified 'fieldToShift' field ("color" in this case) back by one index position relative to the rest of the fields in the record. If the 'fieldToShift' field is Null then the node simply shifts the entire record back by one index position. In either case, the a final record is output with all Null values to emulate the operation of the pandas shift function.

    Note, if you just wanted to calculate the numeric change in the value of a field from one record to the next then you can use the approach shown in the 'Calculate Change from Previous Record' Transform node.

     

    0
    Comment actions Permalink
  • Avatar
    Adrian Williams

     

     

    Attached files

    Shift _Field_Example - 12 Oct 2021.lna

     

    0
    Comment actions Permalink
  • Avatar
    firoz Pathan

    Thanks Adrian 

    0
    Comment actions Permalink

Please sign in to leave a comment.