Forum Replies Created

  • RVR

    Member
    September 7, 2022 at 12:00 am in reply to: Accumulators – Access additional list / column

    Thanks for confirming. I checked both solutions and the result column matches exactly for my bigger data set.

  • RVR

    Member
    September 6, 2022 at 12:00 am in reply to: Accumulators – Access additional list / column

    I was trying something like below. I am not sure if it works in all scenarios.

    I will validate your solution as well and revert soon.

    Thanks much for your patience. KX community support and response is just excellent

    update c2: {?[((y>x)|(z<x));y;x]}[0;c1;0^prev c] from t 
    c c1 c2 
    ---------- 
    30 10 10 
    40 20 20 
    25 5  20 
    20 25 25 
    4  5  5 
    4  4  4 
    4.5 3 4 
    4.5 3.5 4

     

     

  • RVR

    Member
    September 6, 2022 at 12:00 am in reply to: Accumulators – Access additional list / column

    Somehow not being able to use the previous calculated value of c2 directly is causing fallout for different combination of data. Last value of c2 will be 4 as per the logic but we get 3.5

    t:([]c: 30 40 25 20 4 4 4.5 4.5; c1: 10 20 5 25 5 4 3 3.5)

     

    c c1 c2 c1>prev c2 OR prev c < prev c2 ? c1 prev c2
    30 10 10 10>0 (True) OR No need of evaluation ? 10
    40 20 20 20>10(True) OR No need of evaluation ? 20
    25 5 20 5>20(False) OR 40<20(False) ? 20
    20 25 25 25>20(True) OR No need of evaluation ? 25
    4 5 5 5>25(False) OR 20<25(True) ? 5
    4 4 4 4>5(False) OR 4<5(True) ? 4
    4.5 3 4 3>4(False) OR 4<4(False) ? 4
    4.5 3.5 4 3.5>4(False) OR 4.5<4(False) ? 4

     

    update c2:fills ?[(c1>prev c1) or prev[c]<prev c1;c1;0N] from t 
    c c1 c2 
    ----------- 
    30 10 10 
    40 20 20 
    25 5  20 
    20 25 25
    4  5  5 
    4  4  4 
    4.5 3 4 
    4.5 3.5 3.5

     

  • RVR

    Member
    September 5, 2022 at 12:00 am in reply to: Accumulators – Access additional list / column

    Thanks rocuinneagain,

    Works for most scenarios. I have added one more row at the end where I get a different result than expected. The value for c2 in last row should be 4 instead of 3.

    t:([]c: 30 40 25 20 4 4 1; c1: 10 20 5 25 5 4 3)

     

    c c1 c2 c1>prev c2 OR prev c < prev c2 ? c1 prev c2
    30 10 10 10>0 (True) OR No need of evaluation ? 10
    40 20 20 20>10(True) OR No need of evaluation ? 20
    25 5 20 5>20(False) OR 40<20(False) ? 20
    20 25 25 25>20(True) OR No need of evaluation ? 25
    4 5 5 5>25(False) OR 20<25(True) ? 5
    4 4 4 4>5(False) OR 4<5(True) ? 4
    1 3 4 3>4(False) OR 4<4(False) ? 4

     

    update c2:fills ?[(c1>prev c1) or c<prev c1;c1;0N] from t 
    c c1 c2 
    -------- 
    30 10 10 
    40 20 20 
    25 5 20 
    20 25 25 
    4  5  5 
    4  4  4 
    1  3  3

     

     

  • RVR

    Member
    January 5, 2022 at 12:00 am in reply to: Accessing previous calculated value from a column in current row

    Wow!! Thanks Jason & vkennedy.

  • RVR

    Member
    January 4, 2022 at 12:00 am in reply to: Accessing previous calculated value from a column in current row

    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.

     

  • RVR

    Member
    January 4, 2022 at 12:00 am in reply to: Accessing previous calculated value from a column in current row

    Hi,

    I have added the calculations below.

    c1 c2 Calculation
    1 5.5 =((0+10) + 1)/2 =((prev(c2)+10)+c1)/2
    2 8.75 =((5.5+10) + 2)/2
    3 10.875 =((8.75+10) + 3)/2
    4 12.4375 =((10.875+10) + 4)/2
    5 13.71875 =((12.4375+10) + 5)/2
    6 14.859375 =((13.71875+10) + 6)/2
    7 15.9296875 =((14.859375+10) + 7)/2
    8 16.96484375 =((15.9296875+10) + 8)/2

    c2 column values is the expected result.

  • Okay. I was able to get one of my old dashboard working. This is what I did.

    Go to the old version KX Dashboard folder. In my case KXDashboards-1.4.1.

    Navigate to KXDashboards-1.4.1 > dash > data – folder. There are two folders here, “connection” and “dashboard”. This contains the connections and dashboards created.

    Open the JSON files with Notepad or Notepad++ and check the name. This will be the name with which you saved your dashboard (Tip: Sort the files in descending order. Latest changed dashboards will be at top).

    Copy over the connection and dashboards needed to the corresponding folders in new version.

    Restart the dashboard.

    Experts can confirm if this is the right approach.

  • RVR

    Member
    September 11, 2024 at 6:41 pm in reply to: Store array of bytes in a table column

    Exactly what I was looking for. Thanks 🙂