how to sequentially repeatedly execute another script via Util.Run()

edited May 2018
Hello to everyone,

this is my first post on this forum.
So far I was able to find solutions to all my LINQPad questions, this time I failed.

I have a worker script which I would like to be able to call in a sequential manner from a control script via Util.Run(). I need to let the worker (called) script finish prior to another run. The behaviour I observed is that in fact the controlling script fires up multiple instances of the worker script in parallel/asynchronously.

Am I missing something or is this not supported?

Excerpt from the calling script code:

/// the main part of the script
void MainScript()
string sScriptName = "ODI_GetSessionsFromOperator";
Dictionary dParams = new Dictionary();
dParams.Add("sRepoLeft", "1805_T12");
dParams.Add("sRepoRight", "1805_T12");
dParams.Add("sBatchIdFilterLeft", "1160329211");
dParams.Add("sBatchIdFilterRight", "");
dParams.Add("showComparison", "false");
dParams.Add("storeRawFile", "false");
dParams.Add("overrideExistingFile", "false");
dParams.Add("version", "1"); // minimum required version of the called script as identified by its GetVersion() method
dParams.Add("sTableNameSQLLikeFilter", @%L2I\_%CLS\_GEB%);
RunScript(sScriptName, dParams);
// >> here I want to wait for the previously called script to finish before running it again <<
dParams["sTableNameSQLLikeFilter"] = @%L2I\_%CLS\_WSS%;
RunScript(sScriptName, dParams);

void RunScript(string aQueryName, Dictionary<string, string> aInputParams)
using (StreamWriter file = File.CreateText($@{Path.GetDirectoryName(Util.CurrentQueryPath)}\config\Input.{aQueryName}.json))
JsonSerializer serializer = new JsonSerializer();
serializer.Serialize(file, aInputParams);
aInputParams.Dump($"aInputParams at {DateTime.Now}");
Util.Run(aQueryName+".linq", QueryResultFormat.Html, null).Dump();



  • Hi,

    I have found what I was looking for. Wait() method.
    Now I have to rewrite parts of the worker script as my Hyperlinqs actions do not work now that they are dumped in the calling scripts result tab plus some other quirks in the behaviour of DumpContainers ... Still a lot to learn :smile:

Sign In or Register to comment.