Given error in views but not in queries

https://learninghub.kx.com/forums/topic/given-error-in-views-but-not-in-queries

Hi there,

I am currently working with KX Insights Enterprise and I am having a problem.

I have the following code to display and work with some tables:

foo: {[id; d1; d2; size; handle] 
d_f:(`table`startTS`endTS`filter`groupBy`agg)!(`table_test; date1; date2;(("="; `sym; id); ("="; `side; "0"); ("="; `size; size)); enlist `time; enlist (`avgprice`avg`price));
t_f: handle(`.kxi.getData; d_f; `;()!()); 
t_f 
} 
h: hopen`$":some_dir:4000";
res: foo[id; date1; date2; ;h] each 500000 1000000 10000000 res 
hclose h;

so, this code will call the foo function which receives an id, two dates and a handle, in order to query a table from a database. I am trying to call this method several times using an iterator, for different sizes. This code is actually working when I use a query, and I run the scratchpad, giving me the actual tables I am asking for. Instead, when I use it as a data source, I got the rank error, and I cannot figure out what it is actually happening.

 

Some advice?

 

Kind Regards!

 

 

It looks like you are trying to send an IPC query from the database to the database which is not supported. It is unclear where you are running it.

If that is a data source in a dashboard, that code is getting shipped to a DAP and then it is trying to query itself, which is not supported.
Megan

Why is not a valid query for qsql endpoint?

 

Thanks,

Cristian

Hi !

This isn’t a valid query for the qsql endpoint. The difference between Query and View is that a view would be calling ‘/servicegateway/qe/qsql’ whereas the query goes via Scratchpad.

If you have any more questions feel free to reach out.

Thanks,

Megan