2 Replies Latest reply on Feb 18, 2009 9:47 AM by (A._Phillips)

    Merging Form Data

      I currently have a process that assigns a task to multiple users in parallel using a gateway with a loop. Once all the users have completed the form the process then goes back to the process initiator. I have this all working fine, but my problem is merging the form data. I need to figure out how to merge the form data from the task with the original form data, without over writing any other fields that are filled out. Currently what is happening is the form data is being overwritten every time a user completes the form, and when the form goes back to the process initiator the data on the form is only showing the data from the last user who completed the form.
        • 1. Re: Merging Form Data
          Steve Bishop Level 2
          The output from the assign to user step must be assigned to a different variable than your 'master copy'. I am doing something similar where each user can update a section on the form specifically allocated for him/her. As I loop through to assign the forms, I put the loop index into the form data. So each user has a separate copy with the corresponding index. After submit, I pull the index out and merge that one users data into the master copy.

          /process_data/@processIndex = number(/process_data/tempForm/xdp/datasets/data/Formdata/userIndex)
          /process_data/xfaForm/xdp/datasets/data/Formdata/Approvers/Approver[number(/process_data/@ processIndex)] = /process_data/tempForm/xdp/datasets/data/Formdata/Approvers/Approver[number(/process_data /@processIndex)]

          If anyone can edit any part of the form, you are not going to get around the whoever saves last wins issue. Each user's copy of the form is a snapshot at the point of assignment, not render. So the second (not counting originator) user will not see data entered by the first. I use a custom render that reads the latest master copy out the database.
          • 2. Re: Merging Form Data
            Level 1
            That's great that worked perfectly, thanks for the help.