Change Namespace programatically

Hello,

I am trying to change the namespace programatically to the clients username to avoid name collision.  

I have been trying to add something like 

.z.po:{system "d ", .z.u}

but get a `rank error.  Has anyone tried or dealt with this before?

Try

.z.po:{system "d .", string .z.u}

Thanks Zak that did fix the `rank error but doesn’t actually change the namespace.  I was hoping that after .z.po is called and I declare a variable then it gets added to .username.var.

the namespace is changed for the duration of the ipc call only.

q)h:hopen 5000

q)h({system “d .auser”;`b set 1;};::)

q)h(system;“d”) / remote always defaults to `. for ipc

`.

q)h".auser.b"

1

Oh right. In that case, it would be better to create a function that can be called by the user. Something like this:

/ on the server, create the following two functionssetVar:{[variable;val] set[ sv (;.z.u;variable);val];}getVar:{[variable] get[ sv (;.z.u;variable)]}/ then on the client, hopen to serverq)h:hopen 5000q)h"setVar[x;5]"q)h"getVar[x]"5

``

Right, that makes sense.  Thanks Zak and Charles.