Please advise how to select with variable

Hi,
   I created a table with two columns; eid & name, respectively.

t:( eid:1 2 3 4 5;name:ABCDEF)

f:{ x[0]}

a:f[“A1234567”]

However, I am unable to retrieve a answer correctly, Please advise how to modify the statement <answer is incorrect>, make it as same as the statement (answer is correct) 

<answer is incorrect> select eid from t where name=a

(answer is correct) select eid from t where name=`A

Hi,

The type that you are extracting with f[“A1234567”] is a character , but the values in the name column of your table are symbols. You
will need to cast the value of a in the select statement to a symbol before using it in the query.

    select eid from t where name =`$a


Mark Rooney
Financial Software Developer
AquaQ Analytics

Hi Mark,

 I got the answer, thank you

Regards,

Nelson.

May I ask a additional question.

e.g.

x:select eid from t where name =`$a


x mod 11 (q replied error)


Would you advise me what wrong with the syntax?

On Monday, May 25, 2015 at 12:01:18 AM UTC+8, mark....@aquaq.co.uk wrote:

Hi,

The type that you are extracting with f[“A1234567”] is a character , but the values in the name column of your table are symbols. You
will need to cast the value of a in the select statement to a symbol before using it in the query.

    select eid from t where name =`$a


Mark Rooney
Financial Software Developer
AquaQ Analytics

The select statement will return a table. You should be able to use exec instead to extract the first matching value:

q) x:exec first eid from t where name = `$a
q) x mod 11

Note that the result of the calculation will be 0N (null) if the name is not found.

Hi Mark,
   Thank you very much, it solved.

Regards,

Nelson