[PDM] Transition condition: equality between two variables

Hi all

In writing a transition condition, can we compare the values of two variables with each other?

Thank you.

Hello @jerome.lamar , welcome to the forum.

Could you give an example of a comparison you would like to make?

From memory (I don't use pdm anymore), it is not possible to directly compare 2 variables. It is necessary to be clever in the definition of several conditions, or even to create specific variables used only for transition conditions.

I'm very interested in this topic!
I try to compare during a transition the name of the person who passes the transition (Transmitter Name variable) with the name of the last person who modified the plan (with us it's a specific variable _ModifiéPar) to block a sneaky little guy who has fun bypassing the document validation procedures. If anyone has a tip, I'll take it!

Hello @lmoreau

There is a specific option to handle sneaky little ones in PDM:

Disallow Sequential State Changes Does not allow two sequential state transitions to be performed. As an example, you can use this option to prevent users from approving their own files.

Setting Transition Rights - 2024 - SOLIDWORKS PDM Help

I'm already using it :wink:
Basically, when a user completes a plan, they make a request for validation via a transition. The " prohibit sequential chgt" option therefore prohibits this user from validating his own plan.

But this sneaky little guy (who is also deceitful and vicious), asked another user to make the validation request (without ever having worked on the plan), to be able to self-validate afterwards without restriction.
I am therefore trying to force the person who makes the request for validation to be the author of the plan.

And if a plan is started by someone and ended by another (rare case in our country) I will find a solution at that time.

Hello

So unless I'm mistaken, under the conditions of the transitions it's not possible (you can't recover the name of the user who made the state change).
On the other hand, if the name of the users is identical to the name written in the variable that displays the author of the plan, then we should be able to get away with the dispatch scripts.

1 Like

Hello

Unfortunately, I have had several confirmations that it is impossible to set a condition on the comparison of two variables with each other.

On the other hand, Cyril.f gave me an idea with the Dispatch scripts.
The script must be enabled " during state transition."
The file where the plans subject to this self-validation ban are stored must be filled in.
You must select your arrival state, i.e. the VALID status, and check the box " Before changing the status "

The following script allows you to compare the creator of the plan (i.e. the one who created the file, not the one who put it in validation) with the logged-in user (i.e. the one who passes the validation transition)

I tested it, it seems to work.
Good luck

2 Likes

That's exactly it. I haven't detailed but it's this type of script

1 Like