KDB: How to match string of possible dates with rows of table?

kdb types
kdb joins
kdb timestamp
kdb symbol to string
kdb+ table
kdb where
q for mortals
kdb+ append tables

I essentially just want to create a date column that represents the date of the filename.

My table filesInDir is just a single column and 4 rows called filepath:


I also have a list of possible dates, 2019.03.12 2019.03.11 2019.03.14. How can match the list of dates with the rows of the table above so that I can get a new column that specifies that date value that matched with the filepath string.

This is how you parse the filePath to get the date, Please note as "\" is the escape sign so you need to write as "\\" instead that or directly retrieve the string from system command.

Created table


Create the date column

update date:{"D"$("_"vs last "\\" vs x)[2]} each filePaths from `filesInDir

I also have a list of possible dates, 2019.03.12 2019.03.11 2019.03.14. How can match the list of dates with the rows of the table above so that I can get a new column that specifies that date value that matched with the filepath string.

Can you give some example illustration on that? Not clear about what you intend and expect to see

If you just want let say a "Flag" column indicating whether the date in the records match with the dateRange, you can simply use a in to match that.

dateRange:2019.03.12 2019.03.11 2019.03.14
update match:date in dateRange from `filesInDir

This will be the output:

7. Transforming Data - Q for Mortals - Q and kdb+, information is lost. Enumeration and parsing in q also fit into the cast pattern. and a symbol. For convenience, we repeat the data types table from Chapter 1. The dyadic prepare text function takes a separator character as its first argument and a table or a list of columns as its second. The result is a list of character strings containing text representations of the rows of the second argument separated by the first. Example: show csv 0: ([]a:1 2 3;b:`x`y`z) Save.

If all your file paths follow the same format as your example ones,you can create a date column pretty easily doing:

update date:"D"$8#'103_'filePaths from filesInDir

Then match with your dates using this column.

Programming examples – Knowledge Base – kdb+ and q , date manipulation; string creation, manipulation and pattern matching; do loops; sending ibm 102 goog 103 q)toxml t "<worksheet><table><row><cell><data� 14. Introduction to Kdb+ 14.0 Overview. In this chapter we provide an introduction to kdb+, which is the database offering from Kx. Roughly speaking, kdb+ is what happens when q tables are persisted and then mapped back into memory for operations.

Another approach using 0:

update date:raze("   D";"_")0:filePaths from filesInDir

It is dependent on the occurrences of _ in your filepaths

9. Queries – q-sql - Q for Mortals - Q and kdb+, Since a table is (logically) a list of records, it is possible to append records in The final query works because it tests the specified string for match against When matching the trades and quotes, you clearly want an equijoin and the date and� The reader needs to see all the data, but we also want to draw attention to some rows based on a condition. In this week’s post, I answer a question from Dawna, a member of one of our training programs. She wanted to highlight the entire rows in a data set when the value in a cell in the row matched a value in a cell outside the table.

14. Introduction to Kdb+ - Q for Mortals - Q and kdb+, It is possible to persist any table (or keyed table) using the general q For example, in a fresh directory /db , we splay a table with a single string column and then a partition slice – e.g., do not include a date column for a daily partitioned table. columns for the list of the records in the partition slice matching the constraint. MATCH is an Excel function used to locate the position of a lookup value in a row, column, or table. MATCH supports approximate and exact matching, and wildcards (* ?) for partial matches. Often, MATCH is combined with the INDEX function to retrieve a value at a matched position.

asc, iasc, xasc – ascending sort | Reference, q)/ simple table q)t:([]a:3 4 1;b:`a`d`s) q)asc t a b --- 1 s 3 a 4 d q)meta asc t c| t f a -| ----- a| j p The sorted attribute is set on the first column given (if possible). By specifying FINAL and using the LAST() function for bottom_tstamp, every row inside each match shows the same date for the bottom of its V-shape. Likewise, applying FINAL LAST() to the end_tstamp measure makes every row in each match show the same date for the end of its V-shape. Without this syntax, the dates shown would be the running value for each row.

Iterators – White Papers – kdb+ and q documentation, The single argument is an applicable value: a list, dictionary, table, process handle, or function. Converge: iterate until a result matches either the previous result or the q)1_ date where differ {get hsym `$"/mydb/",x,"/trade/.d"} each string date 2013.05.03 2013.05.04 Use .z.s only where it is not possible to use iterators. This article explains different techniques that filter rows/records that contain a given text string in any of the cell values in a record. Example, row 3 is extracted above because string AA is found in cell C3. Row 4 and 5 are also extracted because string AA is found in cell D4 and E5 respectively.