0

Im trying to have a function where the output becomes the input of the next iteration. I pass in the table called tab, and want to pass each threshold.

Here is the func:

test:{[data;t]
      
       data:update check:t`t3 from data where id within (t`t1;t`t2)
            
      }/[tab;]threshold
        

Data:

tab:([]id:12 130 44 46 456;side:`S`S`B`S`B;entityVal:123 123 456 456 456;eventType:`New`Filled`New`Partial`Partial)
threshold:([]t1:100 10 39 60 80 100 ;t2:200 20 49 70 90 150;t3:`test1`test2`test3`tes4`tes5`test6);

Can anyone advise what is the issue with the function? Its currently giving a rank: Invalid rank or valence (parameter count) error.

1 Answer 1

1

Your syntax runs without error in my console.

q)f:{[data;t] data:update check:t`t3 from data where id within (t`t1;t`t2)}

/ - https://code.kx.com/q/ref/accumulators/#unary-application

q)tab f/threshold
id  side entityVal eventType check
----------------------------------
12  S    123       New       test2
130 S    123       Filled    test6
44  B    456       New       test3
46  S    456       Partial   test3
456 B    456       Partial

/Same as
q)f/[tab;] threshold
id  side entityVal eventType check
----------------------------------
12  S    123       New       test2
130 S    123       Filled    test6
44  B    456       New       test3
46  S    456       Partial   test3
456 B    456       Partial

over - https://code.kx.com/q/ref/over/

q)f over enlist[tab],threshold
id  side entityVal eventType check
----------------------------------
12  S    123       New       test2
130 S    123       Filled    test6
44  B    456       New       test3
46  S    456       Partial   test3
456 B    456       Partial
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.