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

running number of a flow

Comments

4 comments

  • Avatar
    Stony Smith

    use this:

    emit execCount as myRowNumber

    or this:

    if firstExec then myRowNumber=0
    myRowNumber = myRowNumber +1

    emit myRowNumber
    0
    Comment actions Permalink
  • Avatar
    Shu Ting

    Thank you. What if I want the number to be persistent per run not per row.

    For example, for initial run

    run_id, name, amount

    1, susan, 1000

    1, peter, 200

    1, Samie, 300

    Next time when the data flow is executed

    2, susan, 1212

    2, peter, 234

    2, Samie, 334

    0
    Comment actions Permalink
  • Avatar
    Adrian Williams

    There are probably some more elegant ways to achieve this but... the attached .lna file contains a node that stores a persistent execution count in the specified file. If the file does not exist it is created and the execution count starts at 1.

    Obviously, you must use a unique file for each data flow that would use a persistent execution counter.

    Regards,

    Adrian

     

    Attached files

    Persistent_Exec_Count.lna

    0
    Comment actions Permalink
  • Avatar
    Stony Smith

    Another possible way to do this is to use the date (and time) as a unique identifier

     

    0
    Comment actions Permalink

Please sign in to leave a comment.



Powered by Zendesk