Data manipulation and Emails in IPA

Author
Messages
Joan Herzfeldt
Veteran Member
Posts: 74
Veteran Member

    I need some advice on the best way to send an individual email to multiple people with different data.

    Info: IPA triggered when receive a file. Comes multiple times a day. Has less then 50 records.
    Each file will contain multiple records for the same SA, however the file is in a random order.  I need to send One email to each SA containing information about each record processed for them.  The email can be sent for each file or once a day.

    I've consided:
     1. creating an array for unique SA's; write the records and results to an external file; Loop through SA array and create email by reading the new file (pulling just the records for the current SA)  -- This would cause the file to be read multiple times.
     2.  Write the records and results to an external file; Create crystal report to read the file and have LBI send emails. --this option has an external (from IPA) process.
     3. creating an external file for EACH SA as the data is read. After all records are read and processed have IPA send an email to each SA with Their Attachment only.  (this idea just came to me so isn't entirely flush out yet).
    What are your suggestion?

    David Williams
    Veteran Member
    Posts: 1127
    Veteran Member
      Joan,
      You have several options. You can load the file into memory (Assign to a variable) and then sort it (JavaScript) if the SA is the first record. Otherwise, you can still read it with a for loop and create a new array of the SA's from within the file. Use a DataIterator to cycle through the SA array and pull out the records you want (using JavaScript) to build your new individual file. Within the DI loop, you will retrieve the records matching the SA, write out your file and then email that file (no need to name differently) as an attachment.
      David Williams
      Joan Herzfeldt
      Veteran Member
      Posts: 74
      Veteran Member

        Thank you for your response.  That was my first thought, too.   Since the SA field is the Last field I created a SA_Array I assumed I'd have to use a For Loop node, but DI will work too. (assuming, I use a comma for the delimiter).  I just wasn't sure it there was a better way to do it.

        Thanks for taking the time to review my question.

        ---