AnsweredAssumed Answered

C# PDM add-in : Best way to get list of variables and its values ?

Question asked by Dipak Shah on Jan 29, 2020

Actually i am facing loading issue when getting data card variables one by one which linked with PDM Vault file.

 

Here is my code. please let me know the best way to get variable and its value . or any alternative of it.

 

Basically the performance issue is in code which highlighted (bold) below during getting variable and its value.

 

foreach (EdmCmdData AffectedFile in ppoData)
{

IEdmEnumeratorVariable8 EnumVarObj = default(IEdmEnumeratorVariable8);
EdmStrLst5 cfgList = default(EdmStrLst5);
IEdmPos5 pos = default(IEdmPos5);
object VarObj = null;

var confName = AffectedFile.mbsStrData1;
var result_file_name = ((EdmCmdData)AffectedFile).mbsStrData1;
IEdmFile5 actual_file = vault_iedm5.GetFileFromPath(result_file_name, out IEdmFolder5 folder);
EnumVarObj = (IEdmEnumeratorVariable8)actual_file.GetEnumeratorVariable();
cfgList = actual_file.GetConfigurations();
pos = cfgList.GetHeadPosition();

string Description = "";
string DrawnDate = "";
string DrawnBy = "";
string Weight = "";

while (!pos.IsNull)
{

cfgName = cfgList.GetNext(pos);

EnumVarObj.GetVar("Description", cfgName, out VarObj);
if (VarObj == null)
{
EnumVarObj.GetVar("Description", "@", out VarObj);
}
Description = VarObj?.ToString();

EnumVarObj.GetVar("DrawnDate", cfgName, out VarObj);
if (VarObj == null)
{
EnumVarObj.GetVar("DrawnDate", "@", out VarObj);
}
DrawnDate = VarObj?.ToString();

EnumVarObj.GetVar("DrawnBy", cfgName, out VarObj);
if (VarObj == null)
{
EnumVarObj.GetVar("DrawnBy", "@", out VarObj);
}
DrawnBy = VarObj?.ToString();

EnumVarObj.GetVar("Weight", cfgName, out VarObj);
if (VarObj == null)
{
EnumVarObj.GetVar("Weight", "@", out VarObj);
}
Weight = VarObj?.ToString();


}
}

 

Thanks!

Outcomes