1

This query get the column data fromjust two app types -- STEALTH and BOMB US . This query worked fine until I had to isolate the eventtype column to just "AR" events. There is just too much data to not isolate it. I have never seen so much data. Every other q script I see uses this format to filter columns, an equal sign with a back tick. The result set from this query is much smaller, however label of the the column in the header of the result set, instead of saying "eventtype" just has an X. Also, in stead of "AR" the column data is either a 1 or a 0 - which is probably true or false. I need the column data to say AR if it is in fact AR, not a 1 or a 0. Also, it would be reassuring if the column header said "eventtype" instead of an "x" like it does when I run the script without the (equal backtick AR) =`AR

I am using qpad to run the query

raze{[tradedate] 

setdate tradedate;

`rootordid`clordid xasc

select from( 
        (select ltime transacttime, apptype, rootordid, eventtype=`AR, msgcategory from orders where (apptype like "STEALTH US") or apptype like "BOMB US")
         )}each .utl.get_bdts[2017.12.04;2017.12.05]
Thomas Smyth - Treliant
  • 4,993
  • 6
  • 25
  • 36
capser
  • 2,442
  • 5
  • 42
  • 74
  • This does not throw an error - but it breaks the query -----> from orders where (eventtype like "AR") or (apptype like "STEALTH US") or apptype like "EOM US") – capser Jan 06 '18 at 02:43

1 Answers1

1

The scripts you seen filtering columns using equals backtack are using it to filter columns of symbol type. You can tell the types of your columns by running meta tablename. Filtering data also requires this condition to be in the where clause. For your example above if eventtype is a symbol type then you need to amend your where clause to be either:

where (apptype like "STEALTH US") or apptype like "BOMB US", eventtype=`AR

where eventtype=`AR, (apptype like "STEALTH US") or apptype like "BOMB US"

At this stage the output table will only have AR events in it keep the name eventtype and won't output a boolean list instead.

For more information on select and the where clause check out the Q-SQL page on the wiki.

Note: if eventtype is a string type then you can use eventtype like "AR".


Additionally if apptype is a symbol column you can modify its condition to be:

where apptype in `$("STEALTH US";"BOMB US")

which should improve performance over using like.

Thomas Smyth - Treliant
  • 4,993
  • 6
  • 25
  • 36