KX Community

Find answers, ask questions, and connect with our KX Community around the world.
KX Community Guidelines

Home Forums KX Solutions RDB/IHDB/HDB – What is the best way of a copy of the values of an in-memory table? Re: RDB/IHDB/HDB – What is the best way of a copy of the values of an in-memory table?

  • dcrossey

    Member
    July 6, 2021 at 12:00 am

    Hi Adriano,

    By “q does not like to perform the xkey directly on value table”, do you mean as follows:

     

    q)`name xkey value people

    ‘type

    [0] `name xkey value people ^

     

    Here, we are referring to the table with pass-by-value and q throws a type error. You don’t need to use ‘value’ if you are referring to a table in this manner (note the lack of backtick).

    If you used the ` people with ‘value’ this would have worked as expected (pass-by-reference) :

     

    q)`name xkey value `people 
    name  | age sym 
    ------| ---------- 
    ada   | 33 ada 
    maggie| 25 maggie

     

    In general, I would advise the following syntax for general usage (pass-by-value) :

     

    people:`name xkey people;

     

    Otherwise using pass-by-reference:

     

    people:`name xkey value `people;

     

    Hope this helps.

    Best,
    David