Workflow Soluiton

 View Only
  • 1.  Create an array from multiple Arrays

    Posted Feb 21, 2011 11:28 AM

    In workflow i need to make it so that someone can add multiple user information.   The info on the submit screen needs to have a separte field for First Name, Last Name, and E-Mail.  I was thinking of using 3 list builder components.  I need to then take each list and combine first name, Last name, and e-mail for each element and add it to a new array for final output that should look like

    First Name Last Name E-Mail

    How do I go about doing this or is they a better way to do it?



  • 2.  RE: Create an array from multiple Arrays

    Posted Feb 21, 2011 03:55 PM

    To build your user set:

    1. Use an Add New Data Element comp to set up a counter variable (int) initially set to 0.

    2. Set up a looping structure to verify that the counter is less than the count of the listbuilder output (count should be in the stream)

    3. In the loop, use a Get Item By Index comp 3 times (using the counter var as input) to get the appropriate row of first name, last name, and email

    4. Advance the counter by 1. Thus you get the 2nd row, 3rd row.... nth row.

    As far as "saving" user data, why not use a User Defined Data Type (integration library)? Make a User data type with last name, first name, and email properties.



  • 3.  RE: Create an array from multiple Arrays
    Best Answer

    Posted Feb 22, 2011 10:46 AM
      |   view attached

    For the form, I'd use 3 textboxes to gather the info and a List Select component to display the info to the end-user as they add it. The reason to use textboxes instead of the List Builders is because of the difficulty of doing validation on the three separate List Builders. For example, someone could put in all First Names in one List and skip the others or they could accidentally remove one entry from a List and throw off the matching so all entries for the other Lists are mismatched.

    To use the textbox and List Select method, on the form add three textboxes and labels for First Name, Last Name and Email. Add a button named 'Add' (or a subDialog component). This will be used to Add entries to your array and List Select component. Outside the form (or in your subDialog component Interaction tab) add an "Add Items To Collection" component to map in the three text entries as a new element to your array. Pass the output from that component back into your form. Setup the List Select component to show your array. You can add 'Edit' and 'Remove' actions to your List Select so users can individually remove or edit an entire element. You'll still want to have the User Defined Data Type reecardo mentioned to save your data.

    I've added a package file of a demo project (Workflow 7) on how to do this for clarity. (File is zipped because uploader does not allow *.package files to upload)

    Attachment(s)

    zip
    DEMO_ArrayBuilder.zip   1.10 MB 1 version


  • 4.  RE: Create an array from multiple Arrays

    Posted Feb 23, 2011 11:34 AM

    Hello Matzebru,

    It looks like you array is an integration. Why type of integration is it?



  • 5.  RE: Create an array from multiple Arrays

    Posted Feb 23, 2011 12:09 PM
      |   view attached

    It's a User Defined Data Type Integration that I created. I've zipped up that package file and attached it to this post if you want to take a look at it.

    Attachment(s)



  • 6.  RE: Create an array from multiple Arrays

    Posted Feb 24, 2011 10:22 AM

    One more Question.  We are running Helpdesk 6 and it cannot display arrays.  Normally I use the Build Text From Elements and give it the Array and have it separate the elements with commas.  When I do it this way it only lets me give one sub element of the array like FName.  How can I set this up so it would display more like.

    Fname LName Email, Fname2 LName2 Email2,...FnameN LnameN EmailN 



  • 7.  RE: Create an array from multiple Arrays

    Posted Feb 24, 2011 11:18 AM
      |   view attached

    There might be a better way to do this but I did it by adding a For Each Element component followed with a merge text to merge the FName, LName and Email for the current element and then added that to a text array to hold the values while in the For Each loop. Once out of the loop, do the Build Text From Elements component with a ", " for the delimiter and then the output of that component is what you put in the comment of the Create or Edit Ticket component. Here is what it looks like:

    I updated the package file with my changes and attached them to take a closer look at how I did this.

    Attachment(s)

    zip
    DEMO_ArrayBuilder_0.zip   1.19 MB 1 version