select vs find

Content-Disposition: inline Hello,

I have to find the key using value of a single column (not the whole row).
This is what I have:

q)select [10] from CUSTOMER
C_ID      | C_TAX_ID         C_ST_ID C_L_NAME     C_F_NAME    C_M_NAME C_GNDR..
----------| -----------------------------------------------------------------..
4300000001| “078GO5457DB627” ACTV    “Fowle”      “Joshua”    W        M     ..
4300000002| “803MO6290MK444” ACTV    “Swigert”    “Willie”    N        M     ..
4300000003| “329GW9315LX866” ACTV    “Labree”     “Amos”      G        M     ..
4300000004| “047YK9898LQ614” ACTV    “Ciciora”    “Charlotte” C        F     ..
4300000005| “805QP9293HR611” ACTV    “Criscuolo”  “Franklin”  F        M     ..
4300000006| “079CV0265WT109” ACTV    “Rohrscheib” “Constance” A        F     ..
4300000007| “414RB8918PT543” ACTV    “Burtchell”  “Jason”     V        M     ..
4300000008| “857CV4901DE721” ACTV    “Kules”      “Thomas”    T        M     ..
4300000009| “834EZ4964IF367” ACTV    “Moe”        “Richard”   A        M     ..
4300000010| “090EI5140VB829” ACTV    “Proud”      “Lydia”     G        F     ..
q)meta CUSTOMER

c        t f           a
C_ID     j
C_TAX_ID C
C_ST_ID  s STATUS_TYPE
C_L_NAME C
C_F_NAME C
C_M_NAME s
C_GNDR   s
C_TIER   i
C_DOB    s
C_AD_ID  j ADDRESS
C_CTRY_1 s
C_AREA_1 s
C_LOCAL_1 s
C_EXT_1  s
C_CTRY_2 s
C_AREA_2 s
C_LOCAL_2 s
C_EXT_2  s
C_CTRY_3 s
C_AREA_3 s
..
I want to find the C_ID given the C_TAX_ID.

q)cust_id: select C_ID from CUSTOMER where C_TAX_ID like “078GO5457DB627”
q)cust_id
C_ID

4300000001

Then I looked into the Tutorials and decided to use find operator since I want the key value from the data value
q)cust_id2: CUSTOMER?C\_TAX\_ID!("078GO5457DB627") 'type q)cust\_id2: CUSTOMER?(C_TAX_ID!“078GO5457DB627”)
'type

a) What am I missing here? Further, does the find (or reverse lookup) need entire row for determining the key value?
b) Alternatively from the select result, how do I pick up just the value array (I do not want the header row)? [I am guessing I would be redirected to read the tutorial here. Well, I am digging around in parallel…but a clue would help:)!]

~Yuva

Content-Disposition: inline Extracting from a table format: I found this.
q)c:value flip cust_id
q)c
4300000001

Thanks,
Yuva

> q)c:value flip cust_id
> q)c
> 4300000001

That flips the table to a dict and extracts the values of from said
dict - hence it gives you your value in this case.
Another way would be:

/ gives a list = the row named C_ID
exec C_ID from cust_id

You can then always just run “first” on that list if you want just the
first item…

> Then I looked into the Tutorials and decided to use find operator since I> want the key value from the data value> q)cust_id2: CUSTOMER?C_TAX_ID!("078GO5457DB627")\> 'type\> q)cust_id2: CUSTOMER?(C_TAX_ID!“078GO5457DB627”)> 'typewell, the first thing you’re doing there is trying to make adictionary from an atom and a list. trycust_id2:CUSTOMER?(enlistC_TAX_ID)!enlist"078GO5457DB627"second, your two statements above are identical, and neither of themneed any parentheses (though mine does)q)(parse"cust_id2:CUSTOMER?(C_TAX_ID!"078GO5457DB627")")~parse"cust_id2:CUSTOMER?C_TAX_ID!(\"078GO5457DB627\")"1botherwise, you're on the right trackq)a:([b:1 2]c:3 4)q)a?(enlistc)!enlist 3b| 1btw, when dealing with tables as complex as yours, if you want us tobe able to work with your data directly, i suggest the following:enter “\c 1000 1000” to widen q’s console to its max, then use "0N!"to get an “executable” version of your table:q)\c 1000 1000q)0N!select from a;(+(,b)!,1 2)!+(,c)!,3 40N! displays any q data in its k4 representation, which is pastable in k modeq)k)aa:(+(,b)!,1 2)!+(,c)!,3 4q)aa~a1balternatively, define my “unshow” function, which does more or lessthe same thing(strictly speaking, it gets the printable representation and writes itto stdout):q).q.unshow:{-1@-3!x;}q)unshow a(+(,b)!,1 2)!+(,c)!,3 4