Yes/No Variable Type in PDM

Discuss SolidWorks PDM
User avatar
charlesculp
Posts: 19
Joined: Fri Mar 26, 2021 3:52 pm
Answers: 0
x 4
x 13

Yes/No Variable Type in PDM

Unread post by charlesculp »

I making some significant improvements to a PDM system. I know 10 years ago, using the variable type "Yes/No" was a mistake, because the different systems (Dispatch, PDM, Solidworks) used different values for what Yes/No means. One used 1,0, another -1,0, another "Yes" and "No".

In this new system, since 10 years has passed, I have wistfully assumed that they fixed it somehow. Why, I don't know. But now comes the real question, what do I put in this "Value" field?
image.png
by jcapriotti » Wed Dec 11, 2024 1:08 pm
@charlesculp The ghost of this issue has been around a long time. I only see a -1 value if using dispatch to set the variable. There is a hotfix I just noticed for this for 2023 sp5....and its labeled fixed in in 2024 sp1.

My Dispatch script that checks this value is written to check both:
image.png
Then I have cases where the variable type is Yes/No but I don't use a checkbox....I have a droplist with Yes/No and a blank line. In that case, I want to force the user to make a decision so it defaults to an empty value, then the transition checks to ensure there is a value. Can't really do that with a checkbox. However that complicates the DB by now have yes/no/blanks in the table.
Go to full post
User avatar
charlesculp
Posts: 19
Joined: Fri Mar 26, 2021 3:52 pm
Answers: 0
x 4
x 13

Re: Yes/No Variable Type in PDM

Unread post by charlesculp »

Answering my own question. Checked one box and not the others on a test data card. Found it from the Preview tab showing the variables.
-1 is Yes, 0 is no.
image.png
image.png (2.35 KiB) Viewed 357 times
User avatar
AlexB
Posts: 508
Joined: Thu Mar 18, 2021 1:38 pm
Answers: 29
x 274
x 462

Re: Yes/No Variable Type in PDM

Unread post by AlexB »

It seems to stem from the inconsistencies within different programming languages themselves. Boolean (1 is true, 0 is false) vs. Variant_Bool (-1 is true, 0 is false) each seem to be used throughout the API and likely add-ins such as Dispatch or even PDM/Solidworks. I don't foresee this being something that gets fixed, rather a pain we have to work around.
User avatar
jcapriotti
Posts: 1897
Joined: Wed Mar 10, 2021 6:39 pm
Answers: 32
Location: The south
x 1236
x 2029

Re: Yes/No Variable Type in PDM

Unread post by jcapriotti »

@charlesculp The ghost of this issue has been around a long time. I only see a -1 value if using dispatch to set the variable. There is a hotfix I just noticed for this for 2023 sp5....and its labeled fixed in in 2024 sp1.

My Dispatch script that checks this value is written to check both:
image.png
Then I have cases where the variable type is Yes/No but I don't use a checkbox....I have a droplist with Yes/No and a blank line. In that case, I want to force the user to make a decision so it defaults to an empty value, then the transition checks to ensure there is a value. Can't really do that with a checkbox. However that complicates the DB by now have yes/no/blanks in the table.
Jason
User avatar
charlesculp
Posts: 19
Joined: Fri Mar 26, 2021 3:52 pm
Answers: 0
x 4
x 13

Re: Yes/No Variable Type in PDM

Unread post by charlesculp »

jcapriotti wrote: Wed Dec 11, 2024 1:08 pm @charlesculp The ghost of this issue has been around a long time. I only see a -1 value if using dispatch to set the variable. There is a hotfix I just noticed for this for 2023 sp5....and its labeled fixed in in 2024 sp1.

My Dispatch script that checks this value is written to check both:
image.png

Then I have cases where the variable type is Yes/No but I don't use a checkbox....I have a droplist with Yes/No and a blank line. In that case, I want to force the user to make a decision so it defaults to an empty value, then the transition checks to ensure there is a value. Can't really do that with a checkbox. However that complicates the DB by now have yes/no/blanks in the table.
Thanks Jason, great information.
User avatar
charlesculp
Posts: 19
Joined: Fri Mar 26, 2021 3:52 pm
Answers: 0
x 4
x 13

Re: Yes/No Variable Type in PDM

Unread post by charlesculp »

After testing this afternoon, checkboxes in a data card do not appear to be compatible with Yes/No variable type and a custom property set to Yes/No.

I feel like I was able to get this to work before, but maybe the data type for the variable was Text in PDM.

When I edit the data card in the File Explorer Extension, it works fine. When I use the PDM Add-in in Solidworks, it doesn't work! With variable type set to Text, or to Yes/No; same functionality. Wild, seems more like a bug. More research is needed, but I am using SW2022 SP5.
User avatar
jcapriotti
Posts: 1897
Joined: Wed Mar 10, 2021 6:39 pm
Answers: 32
Location: The south
x 1236
x 2029

Re: Yes/No Variable Type in PDM

Unread post by jcapriotti »

Definitely some inconsistency in how its handled.

Here's some values. Two different variables (256, 360), both are set to Yes/No data types. One uses a drop list with Yes/No, the other is a checkbox (0,1). Not sure how this affect PDM functionality. All variable values are stored several times depending on data type and the card control (checkbox, drop list, etc.). Seems every variable's value is stored as a text string in "Value Text" and "ValueCache". I guess this comes into play when searching depending on the search card control type.
image.png
Jason
Post Reply