Workflow Soluiton

 View Only
  • 1.  Create Function

    Posted Aug 12, 2010 10:39 AM
      |   view attached
    I have to Call store procedures and other components multiple times in different location within my workflow.  I was wondering if there is any way to create something like a function so I could just call the store procedures  when I needed instead of having to redo everything everytime I needed to run the stroe procedure and the other components that go with that store procedure.  I have attached a screen shot of what I have to call multiple times.


  • 2.  RE: Create Function
    Best Answer

    Posted Aug 12, 2010 10:58 AM
    You can build this as a sub process and call it as a webservice.  This is achieved by creating a separate Decision Only project in Workflow, then publishing it as a webservice and creating an integration component to call it.  This is the most reusable option as it can be called easily by any project by just including the library with the integration built into it.

    Second option, you can build a sub  model within the same project and call it with a Linked Model component.  To make a a new model, under the Project window on the left select the top level of the project.  Then under the file menu, select new model.  Once your model is built (complete with input data and output data) you can then call it from anywhere in the same overall project with a Linked Model component.

    Hope this helps.

    -Aaron


  • 3.  RE: Create Function

    Posted Aug 12, 2010 10:59 AM
    Anytime you have repeatable code, you should try to put them into a new model (right click on the project name in the left pane).  Set the input and output parameters on the model, and the use the Linked Model component to call the secondary model.  There should be a more detailed explanation in the product docs.  I think there's also a section on this in the product training, but it's been a couple of years since I attended.


  • 4.  RE: Create Function

    Posted Aug 12, 2010 11:05 AM
    Not sure I am understanding your objective clearly.  Are the results of the stored procedure expected to be different each time you call it?   If not, the easy answer is store the result in a variable, but I suspect that if it was that easy you would already be doing it.

    So, if your question is how do you group these same common steps into 1 component, then the answer would depend on what data needs to visable within the group and what results need to be visable outside that group?

    Perhaps a simple solution would be to create a mini webservice(seperate process) that performs the functions of this group of common components, returning the results as XML.  Then you could use the 'HTTP Get' componet to call that new web service (use a dynamic model to build the URL passing varibales) as needed and then parse your results using the 'ImportItemXmlStringComponent'