KX Community

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

Home Forums kdb+ Capstone 2 1.7 Fail missmatch type error

  • Capstone 2 1.7 Fail missmatch type error

    Posted by Nayan on September 1, 2024 at 1:04 am

    1.7 fail

    code:

    / Step 1.7

    csvPath: getenv[`AX_WORKSPACE], “/FP.Data/message.csv”;

    / Load the CSV file and store it in a table named messages

    messages: (“I S”) 0: csvPath; / ‘I’ for trade_id (int) and ‘S’ for exch_message (string)

    messages: update trade_id_str: string trade_id from messages;

    any suggestions?

    megan_mcp replied 2 months, 2 weeks ago 4 Members · 5 Replies
  • 5 Replies
  • mwoods

    Administrator
    September 2, 2024 at 12:15 pm

    Can you please share a screenshot of what you are running and the error? I cannot see from the code snippet what exactly you have run (apologies this formatting issue on the forum is due to be fixed soon).

    Bit mismatch error indicates your column is one datatype and the data you’re trying to add is different datatype.

    Here is what meta messages returns and the first few rows of the table if that helps.

  • mwoods

    Administrator
    September 2, 2024 at 3:25 pm

    Does line 36 run for you? I would think that would throw a type error as you’e passing a string to hsym. https://code.kx.com/q/ref/hsym/

    Can you print out values of csvPath, meta messages and first few lines of messages in console and send screenshot?

    • Nayan

      Member
      September 2, 2024 at 3:33 pm

      here’s the console ss, It throws nyi (not implemented yet) error for
      “first 10 messages”

      • megan_mcp

        Administrator
        September 4, 2024 at 11:01 am

        Hi Nayan,

        This is an example format of how you should load in a CSV file:

        t:("SFI";enlist",") 0: `$csvPath
        • No spaces between the column types
        • The use of ‘enlist’ which is the delimiter used to return the CSV as a table

        Use this format to adjust your answer accordingly. If you have any further questions, please let me know 🙂

        Thanks,

        Megan

Log in to reply.