KX Community

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

Home Forums kdb+ Challenge 4 – World Cup Re: Challenge 4 – World Cup

  • megan_mcp

    Administrator
    August 3, 2023 at 12:00 am

    This is exactly the output I wanted thanks ! Plus that article you tagged is very useful.

    q) data:flip`player`country`minute!("SSS";";")0:`:goals.txt 
    q) exec (string[player],'" from ",/:string[country],'" scored a goal in the ",/:string[minute],:"th minute") from data 
    "Gazinsky from Russia scored a goal in the 12th minute" 
    "Cheryshev from Russia scored a goal in the 43th minute" 
    "Cheryshev from Russia scored a goal in the 91th minute" 
    "Dzyuba from Russia scored a goal in the 71th minute" 
    "Golovin from Russia scored a goal in the 94th minute" 
    "Gimenez from Uruguay scored a goal in the 89th minute" 
    "Cheryshev from Russia scored a goal in the 59th minute" 
    "Dzyuba from Russia scored a goal in the 62th minute" 
    "OG from Russia scored a goal in the 47th minute" 
    "Salah from Egypt scored a goal in the 73th minute" 
    "Suarez from Uruguay scored a goal in the 23th minute" 
    "Suarez from Uruguay scored a goal in the 10th minute"...

    However when I try putting 0N! each in front of the statement I get a parse error?

    q) data:flip`player`country`minute!("SSS";";")0:`:goals.txt 
    q) 0N! each exec (string[player],'" from ",/:string[country],'" scored a goal in the ",/:string[minute],:"th minute") from data 
    parse error