KDB+ / Q Accessing root namespace from namespace
Asked Answered
L

1

7

how can I access functions/variables in the root namespace once I jumped into another namespace.

Example like this:

q)\d .cfg
q)domIV:1000
q)\d .
q)n:1000

And then later on I know how to access the variable domIV from the other namespace, but I dont know how to access the variable n from there:

q)\d .seed
q).cfg.domIV / works
q)n          / does not work
q).n         / does also not work

How can I access the root namespace?

Thanks

Llama answered 7/6, 2015 at 7:2 Comment(0)
M
8

Context (namespace) is just a dictionary so you can use dictionary syntax.

      q)  \d .seed
      q.seed)   `.[`n]

Reference: http://code.kx.com/q4m3/12_Workspace_Organization/

Check section: A Context is a Dictionary

Merovingian answered 7/6, 2015 at 7:40 Comment(1)
you can also use value `..nTautog

© 2022 - 2024 — McMap. All rights reserved.