Hi all
In writing a transition condition, can we compare the values of two variables with each other?
Thank you.
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.
I'm already using it
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.
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
That's exactly it. I haven't detailed but it's this type of script
Well, there's more to do than test! Thank you very much!!
Hello
Congratulations on your script.
However, it may be a little too limiting: For example, we work a lot by copying (3D+MEP). So whoever creates the 3D usually copies an existing one, then modifies the 3D. The person who will update the drawing is often someone else. In this case, your script prevents the creator of the file from checking the work of his colleague who made/modified the drawing.
Hello
Of course, you have to adapt the script to the situation. At home, we also work a lot with copies. But we have a variable on the data card that allows us to retrieve the ID of the person making the copy (and not the original creator). In 90% of cases, it is the person who made the copy who will be responsible for modifying the file. All you have to do is modify the parameters of the variables in the script to retrieve this variable from the data map:
Afterwards, if we have:
ID1: Original Creator
ID2: Copy Creator
ID3: File Modifier
ID4: File validation
ID5: File Validator
That's a lot of users to trace. And I don't even know how to recover the ID3, which only modified the file, without making any state changes or transitions...