Use Dispatch to manage on-the-fly workflows

April 12th, 2011 by

Last week Lou Gallo and I recorded a pod cast discussing SolidWorks Enterprise PDM’s dispatch “script” language. I can’t add much more to the “cool-ness” of dispatch than Lou and I mentioned in the pod cast, but since the recording I have thought of another nice dispatch application I have seen…

SolidWorks has a nice knowledge base article (S-014655) on how you can use a parallel workflow in instances where you need more than one person [group] to be able to approve a document at once.

parallelThis image is a simple example as discussed in S-014655, the concept is -as users push the document through their “voting” transitions, their vote is recorded on the data card. Then via conditions of the transitions, the file either stays and waits for others to vote, or once the file gets all the votes it needs, it then can continue through the life cycle.

The limitation of this example is that all files in this workflow must be approved by all three voters. What if you want the ability to allow your users to determine who needs to vote?

Assuming you have something similar to SolidWorks’ example above, you have some controls that are used to track how the voting is going. Likely you have these “voting” controls read only to keep people from voting for others.

votes

To make this work, you need to add additional controls to give your users the ability to determine who needs to vote. Something like this:

requiredvotes

Here, our user has determined that only “B” and “C” need to vote for this file, so I can ask dispatch to vote for “A” by proxy. (If we don’t get a vote for “A” somehow, the file will not be able to pass through the workflow as designed.)

Next, install dispatch and create a new script.

The concept of the script is pretty close to Lou’s EPDM Dispatch Jumpin’ blog entry. Get the data card variable values and assign them to variable names inside of your dispatch routine.
SetVars

Set the dispatch to run as the file goes through a chosen transistion:

activation

The dispatch script would look like this: (Don’t worry about some of the weird syntax in the “Content” column, the dispatch wizard will build this for you.)

Dispatch

First line tells dispatch to check out the file. (Even the mighty dispatch cannot modify a card without it being checked out.)

The second line says that if person “A” needs to vote (the variable “varAVote” would equal 1 because a checked checkbox is equal to one) jump to the fourth line because I don’t want my dispatch routine to proxy for “A”. However if “A” does not need to vote, the value of varAVote would equal 0 and thus dispatch will simply continue to the third line of the macro.

The third line sets the datacard variable “Vote from A” to 1 – essentially checking the vote check box.

setvarincard

This works even if the control [checkbox] is read-only!

This logic continues for every person that needs to vote, then when we get to the end the file gets checked back in. Don’t worry if everyone is voting and dispatch didn’t change anything. If nothing was changed, the file is “undo check out”ed.

Thus my new file looks like this afterwards:

afterdispatch

I hope I didn’t scare you off, it really is quite easy. As I mentioned, you can think of the dispatch editor as a big wizard, it leads you through the process, it is easier than I made it look.

Jeff Sweeney

CSWE Engineering Data Specialist 3DVision Technologies

Tags: , , ,

4 Responses to “Use Dispatch to manage on-the-fly workflows”

  1. Lou Gallo says:

    Jeff is a wizard! Tis is an awesome implementation of dispatch and I am glad that you “jumped” into dispatch!

  2. Joy Garon says:

    Great example Jeff. If you know of people who want to learn dispatch, have them grab my hands-on presentation from the SWW 2011 proceedings. There will be two files. A Powerpoint and a PDF. The PDF is actually a zip file – so simply rename the extenion and extract. The PDF of the tutorial and the sample files are included.

    Cheers,
    Joy

  3. Brian Dalton says:

    Nice tip, Jeff, but this can also be done without Dispatch. I simply created card variables for each potential signatory (NeedsDonny, HasDonny) to indicate which person needs to sign and whether or not they have signed. Then the transitions used in the parallel workflow simply read these variables. Works great, and no Dispatch needed!

    Also, this is useful in cases where one of the signatories rejects the document and sends it back for modifications. All previously acquired signatures must be voided since the document will be changed after they signed, and this is easily done in the transition used to send the document back for mods.

    B-

  4. Jeff Sweeney says:

    Very clever Brian, so your conditions of the transition must be something like this:?

    or
    –NeedsDonny=0
    –DonnyVotesYes=1
    or
    –NeedsJeff=0
    –JeffVotesYes=1

Leave a Reply


eight + eight =

Follow
Get every new post delivered to your inbox
Join other followers
Powered By WPFruits.com
Bear