Manually set additionalScope for testing purposes

If I have a query which is designed to be called using additionalScope I cannot run it from the editor because the scope variables have not been set. When I am writing in .Net I can tell Visual Studio to set input parameters to use when for debugging. Especially helpful for command line projects but others as well.

It would be nice if I could set the value of {{MyVariable}} somewhere so I can unit test the query outside of the normal workflow.

Hey @bradlymathews, had this issue myself recently.

I opted for a more tedious setup but with greater granularity. Whenever I'm using scope variables I implement them like this:

{{
  typeof(myVariable) == "undefined" 
    ? localStorage.values.myVariable : 
    : myVariable
}}

I have a query which lets me map all scoped variables to local variables. Works fine so far for me. Would that work for you?

1 Like

@minijohn,

Nice! In the past I have used a non ternary version of this syntax for js queries, but this improved version should work for my current sql queries as well.

And I see that you are centralizing them. I don't need to get that fancy but I must say it is really neat.

1 Like