Forum Discussion
Expression.Evaluate object does not exist in the current context
Thanks Marcel, it's great to get some dialog on this and thanks also for your insights regarding the spec. To be honest, I found the syntax of that document impossible to understand but, I might re-visit that now that I have a better idea what's going on.
My view on the #shared intrinsic variable is that this is like a scope object or pointers in the call stack, or an execution context…, and that the PQ engine will try it's best to optimise (minimise) memory use in this object (including objects referenced by it). So the PQ engine will manage the membership of the #shared object based on references it sees in the code.
It seems like the optimisation decisions are different in the Query Editor and the Visual, the latter being more aggressive, but it could be that the QE environment keeps references to all objects, as you would expect for a development environment, and that the visual environment does not. Therefore, the underlying engine does not include unreferenced objects in the current context and that's why I to this work-around.
But anyway, it (the work-around) was nice to find. It was a great moment after too many hours muddling about in the dark. :Q
By the way, do you have any other way to reference a table by name? That's why I fell down this rabbit hole in the first place. Thinking about it now, I guess I could use
myTable = Record.Field(#shared, tableName)
Provided of course the above referencing considerations are satisfied...
Query Dependencies view in the Query Editor (under the View tab in the ribbon) allows you to see all queries and your dependencies on other queries or data sources at a glance, as well as an indicator of their Load status.