Hello,
I am using SOLIDWORKS PDM 2023 and I am trying to read folder card values, but the following scenario is driving me crazy.
- A user creates a folder and sets different values on the folder card.
- The user decides to delete the folder (the reason why is irrelevant here, users are doing user things).
- They decide to create a new folder with the same name and at the same path, and edit the folder card again with different values. Of course, the user presses "save".
- They press a button that is connected to my addin. So, my addin starts and tries to read the folder card values. However, my addin extracts the values from the deleted folder.
How is that possible? What am I doing wrong here?
public void OnCmd(ref EdmCmd poCmd, ref EdmCmdData[] ppoData)
{
vault = poCmd.mpoVault as IEdmVault5;
if (poCmd.meCmdType != EdmCmdType.EdmCmd_CardButton)
return;
if (poCmd.mbsComment != AddInName)
return;
var affectedItemID = ppoData.First().mlObjectID1;
string folderpath = string.Empty;
try
{
if (affectedItemID == 0) // 0 = folder
{
foreach (EdmCmdData cmdData in ppoData)
{
folderpath = cmdData.mbsStrData2;
IEdmFolder5 folder = vault.GetFolderFromPath(folderpath);
if (folder == null)
return;
IEdmEnumeratorVariable5 enumVar = (IEdmEnumeratorVariable5)folder;
if (enumVar == null)
return;
object stlVar = "";
enumVar.GetVar("stlV", string.Empty, out stlVar); // here I get the "old" stlVarIn addition to that, I tried using IEdmEnumeratorVariable6.GetVarFromDb(), but the result is the same.
I do not think it is a caching problem, since other users pressing the button are facing the same issue.
I've checked the folder id of my IEdmFolder5 and the VariableValues on the database. The values belonging to that ProjectID are the new and correct values.
So, how is it possible that the GUI and the database are giving me correct values but the API don't?
