Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How do we update a table column which is list type based on list indices range

How do we update a table column which is list type based on list indices range

sample table
tab:([] date:2024.01.01+til 30;sym:30?`appl`msgt`googl;volume:30#(enlist 0.5+300?til 100));

Lets just work with row1 in current example so its easier

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

exec first volume from tab where i=0 //300

enter image description here

Now, we want to query and update the table tab such that user passes start index and end index, take that and update the volume from tab to zero 0 for that index range.

We have 300 values in volume column for first row as eg. , say user passes start:100;end:200, so here we need to make the index 100 to 200 as zero in volume column where its is first row or any row given.

I tried to solve it by indexing a list but it works for single index but not works for a range of index in update statement

>Solution :

Using . amend

q){[start;end] .[tab;(::;`volume;start+til end-start);:;0f]}[100;200]

This will set indexes 100 to 200 as 0f in every volume row.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading