How to declare a local variable in a custom query

I have some custom queries that have multiple nested queries that are presumably causing poor performance issues (runs for 20+ minutes). One strategy that has worked for me before is to declare a local variable and use the nested query to set the variable (it is a single value), thus I can replace the nested query with the variable (it works in stored procedures, but I can't create a stored procedure, or view, in this case). Is this possible in Easymorph? I also looked into setting a parameter with a query so I could use the parameter to replace the nested queries, but so far I see nothing that will do that. I'm a bit of a fresher to Easymorph so please pardon if I missed an obvious answer.

Hello @Radical-R, and welcome to the Community!

It's possible to use values from the first row of a result of an "Import from database" action in another "Import from database" action using the "First value of column" mode of a value of one of the supported conditions:

As for parameters, when you need to assign parameter values based on a result of an action, you should declare that parameter and all the related actions in a separate module or project and then use the "Call another module/project", "Iterate" or a similar action to assign the parameter value.

Here are the tutorial articles on this topic: