Workflow and ServiceDesk Community

 View Only
  • 1.  Workflow - If/Else Statements

    Posted May 11, 2016 03:12 PM

    I am relatively new to workflow. I would like to use an embedded model to run through a series of If/Else rules. For example: IF variable="xyz" THEN assign a value to a component.

    I found this workflow post where they appear to be doing what I am referring to, https://www-secure.symantec.com/connect/forums/nested-ifelse-statements-workflow, but I can't figure out what component they are using to get the true false options.

    Any suggestions or info would be helpful.

    Thank you!



  • 2.  RE: Workflow - If/Else Statements

    Posted May 12, 2016 04:10 PM
    How about a Decision Table https://www-secure.symantec.com/connect/articles/decision-table There's a Decision Tree component https://www-secure.symantec.com/connect/blogs/workflow-tutorial-decision-tree-demo You could use a number of other components but it would become large True/False Rule https://www-secure.symantec.com/connect/articles/true-false-rule Matches Rule https://www-secure.symantec.com/connect/articles/matches-rule Equals Rule https://www-secure.symantec.com/connect/articles/equals-rule Text Equals Rule https://www-secure.symantec.com/connect/articles/text-equals-rule


  • 3.  RE: Workflow - If/Else Statements

    Posted May 12, 2016 04:17 PM

    I'll normally build a key/value pair array in a data table somewhere (sql custom table, if available).  you could also have a flat file that delimits the values in some way.  so:

    A|Apple
    B|Banana
    C|Carrot

    so that if a text value = A, you can check the array for the corresponding value for the key A, which will then resolve to the value of Apple (then assign that value to whatever variable you need).



  • 4.  RE: Workflow - If/Else Statements

    Broadcom Employee
    Posted May 12, 2016 04:20 PM

    If you are only checking 1 variable against all the different values then I would definately go with a Matching Component. That will reduce the # of components down to a single component to do all your testing. From each possible option you can then control the flow.



  • 5.  RE: Workflow - If/Else Statements

    Posted May 31, 2016 04:09 PM

    Thank you all for the incredibly helpful answers. I am still a little lost on their implementation. I have imported the data from a CSV with column A having the value to search against and column B having the value that should be returned.

    I added the Read CSV to Dynamic Data component to read this data in the model. I am lost on which Key Value Pair comonent to use to read the value in column A and then assign the value from column B to a variable.



  • 6.  RE: Workflow - If/Else Statements

    Posted May 31, 2016 04:15 PM

    use an Initialize Data component to create a Key Value Pair array (you can put this right after the Start component, normally).  then use a multi-value mapping component to map the data type from your CSV to a Key Value Pair data type (we're mapping it in to the variable we created up front, be sure you made it an array in the initialize data component).

    then just connect the lines for whatever you need to be Key and whatever you need to be Value.  Do you want me to have a look at it and help you sort it out?



  • 7.  RE: Workflow - If/Else Statements

    Posted May 31, 2016 05:47 PM

    There are many different ways to achieve this as the others have mentioned previously. My example is just one way to achieve this goal. Attached is a working example workflow project to read the attached csv file and check whether the item in COLUMN_A is a fruit, vegetable or unknown (COLUMN_B). A screenshot of the workflow is also attached for reference.

    Attachment(s)

    zip
    FileToRead.zip   231 B 1 version
    package
    ReadCSV.package   986 KB 1 version