KX Community

Find answers, ask questions, and connect with our KX Community around the world.
KX Community Guidelines

Home Forums kdb+ Accessing previous calculated value from a column in current row Re: Accessing previous calculated value from a column in current row

  • RVR

    Member
    January 4, 2022 at 12:00 am

    Thanks for the reply vkennedy.

    Actually I don’t want to update the existing table at all. Sorry for confusing with update keyword. (But I learnt something new here Thanks).

    Please consider below case. The select fails here.

    t:([]c1: 1 2 3 4 5 6 7 8 9)select c1, c2:((prev(c2)+10) + c1)%2 from t

    How can I use the previous calculated value of c2 in the current row calculation? For the first row in the table there is no prev(c2); so that could be considered as 0. From the second row, it should consider the previous calculated value of c2.