Hi, I have the following method that I call twice, once before an upgrade and once after. I compare csv files generated by getting a table and storing the values into a file before/after. My 'after' csv never gets the full list even though I can see the data in the Element in DataMinerCube. If I run a get primary keys manually it of course gets the updated values. Is the Element object somehow cached? Is there a way I can force a fresh get primary keys on the 2nd run of the method to debug whether this is the issue?
Thanks
public static bool GetLicenses(IEngine engine, IActionableElement element, string fileName, string fileLocation, string logFile)
{
StringBuilder csvContent = new StringBuilder();
string file = fileLocation + "\\Licenses\\" + fileName;
if (!Directory.Exists(fileLocation + "\\Licenses\\"))
{
Directory.CreateDirectory(fileLocation + "\\Licenses\\");
}
File.AppendAllText(logFile, DateTime.Now.ToString("dd/MM/yyyy h:mm tt") + " - SUCCESS|Licenses directory created or existed:" + fileLocation + Environment.NewLine);
string[] rows = element.GetTablePrimaryKeys(500);
var sortedKeys = rows.Select(int.Parse).OrderBy(n => n);
foreach (int sortedKey in sortedKeys)
{
string key = sortedKey.ToString();
var featureValue = element.GetParameterByPrimaryKey(503, key);
if (featureValue.ToString() == "2")
{
csvContent.AppendLine($"{element.GetParameterByPrimaryKey(502, key)}, Enabled");
// engine.GenerateInformation("Feature "+ element.GetParameterByPrimaryKey(502, key)+ " is enabled");
}
if (featureValue.ToString() == "1")
{
csvContent.AppendLine($"{element.GetParameterByPrimaryKey(502, key)}, Disabled");
// engine.GenerateInformation("Feature "+ element.GetParameterByPrimaryKey(502, key)+ " is enabled");
}
}
Hi Ross,
Could you confirm if you are using the NoKeyCaching flag?
Your use case appears very similar to this other question.
Make Element update in Automation Script - DataMiner Dojo
engine.SetFlag(RunTimeFlags.NoKeyCaching); works perfectly!! Thanks!!
I'm not using that flag at the moment, will take a look at this answer. Thanks!