cancel
Showing results for 
Search instead for 
Did you mean: 

Given error in views but not in queries

cperezln
New Contributor II

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!

 

1 ACCEPTED SOLUTION

megan_mcp
Moderator Moderator
Moderator

@cperezln 

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. 

View solution in original post

4 REPLIES 4

megan_mcp
Moderator Moderator
Moderator

Hi @cperezln !

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 🙂

cperezln
New Contributor II

Why is not a valid query for qsql endpoint?

 

Thanks,

Cristian

cperezln
New Contributor II

@megan_mcp sorry I did not tag you 🙂

megan_mcp
Moderator Moderator
Moderator

@cperezln 

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.