PDM API getvar on CardInput gets the previous value

Programming and macros
User avatar
smitty
Posts: 2
Joined: Tue Oct 26, 2021 2:57 pm
Answers: 0
x 9

PDM API getvar on CardInput gets the previous value

Unread post by smitty »

Anyone have this problem?

I have a fairly complex datacard for a virtual file that, i believe, since upgrading to 2022sp5 has been acting up. It seems that when my addin runs from getting the CardInput hook, the value that the program sees is the previous value that was on the card. I've seen it happen with checkboxes and combobox lists- selecting a value produces "" and then selecting it again finally makes it to the program. on checkboxes, checking it off produces 0 and unchecking gives a 1. For some of them, deleting the card control and readding it has fixed it. but on others this fix has not worked. And not every combo/checkbox is doing this, just a few.

i found SPR 1211895 'CardInput hook does not get right variable value' that is 2 years old with no fix, and i cant see the details or vote on it because they borked the customerportal. grumph

just wondering if anyone had a real fix
thanks
-Tom
User avatar
AlexB
Posts: 434
Joined: Thu Mar 18, 2021 1:38 pm
Answers: 21
x 240
x 383

Re: PDM API getvar on CardInput gets the previous value

Unread post by AlexB »

I have a similar one for a folder card using the IEdmEnumeratorVariable5.GetVar method.

SPR 1111411
Desc: GetVar Method (IEdmEnumeratorVariable5) for folder returns values from deleted folder while actually value is empty

My specific issue was that if a folder of the same name existed in the 'recycle bin' of the vault, the API would get the value for that folder card instead of the non-deleted one. I'm assuming this is because the SQL Table ID of the deleted folder was smaller than the ID of the non-deleted one.

So, with all of that said. Do you have a file with the exact same name in the vault recycle bin from the same folder?
User avatar
JSculley
Posts: 574
Joined: Tue May 04, 2021 7:28 am
Answers: 52
x 7
x 806

Re: PDM API getvar on CardInput gets the previous value

Unread post by JSculley »

Solution S-065813 shows an example of how to use the CardInput hook. One interesting thing about it is that when the OnCmd handler is called with the CardInput command type, the subsequent code is wrapped in a lock statement. If you aren't doing the same, it wouldn't surprise me that you are having problems. The user interface thread for the card is likely different than the thread where the add-in is running. Without some sort of synchronization, the two threads can see the overall system in two different states. If you are already using 'lock', start commenting out code until you have a simple example (that still misbehaves) you can post here. If your example includes a CEX export of your vault setup, that would help as well.
Post Reply