local global table variables

A function that has a local table variable

f:{t:( c1:ab; c2:10 20); `t upsert x; show t}

calling the function to upsert a new row in the local table

f(`c;30)

The table is not updated, the reference(back-tick) `t updates the global t.

I have a way to make it work by doing this

f:{t:( c1:ab; c2:10 20); t:t upsert x; show t}

I want to understand, how to upsert/delete inplace for tables defined local to a function.

Hi,

You may want to consider using the , (join) operation inside your function if you have a global table of the same name where upsert will affect this.

f:{t:( c1:ab; c2:10 20); t,:x; t}

This worked well for me and seemed to achieve your desired output.

Hope this helps!