3 Replies Latest reply on Oct 28, 2009 6:23 PM by vu.tuan.anh

    Document ordering in attachment tab

    vu.tuan.anh Level 1

      Hi all,

       

      I am a bit confused about the ordering of document in attachment tab of livecycle.

       

      My customers ask for a chronological order of document when they add attachment from the workflow. I think the easiest way to do is use a list of document, and add new document at the end of the list whenever it is added, but LiveCycle seems to display them in very strange order.

       

      My scenario is:

       

      LCES process adds 5 documents in the attachment list. (it adds 1 document at first task, 2 at second task and the last 2 documents at the third task)

       

      I create following variable:

       

      - attachmentList: List of <document> (to store and display in attachment tab)

      - tempDocument: document (to store generated pdf here and add it into attachmentList)

      - genCounter: int (to differentiate if user generate pdf many times)

       

      After generate the pdf, I call a execute script similar as follow:

       

      =====================================================

      import java.util.List;
      import java.lang.String;
      import com.adobe.idp.Document;
      import java.io.File;

       

      Document doc =  patExecContext.getProcessDataDocumentValue("/process_data/@tempDocument");


      int genCounter = patExecContext.getProcessDataIntValue("/process_data/@genCounter");
      File file = new File("finalDisbursementLetter"+genCounter+".pdf");
      doc.copyToFile(file);
      Document doc1  = new Document(file, true);

       

      List list =  patExecContext.getProcessDataListValue("/process_data/attachmentList");
      list.add(doc1);

      =====================================================

       

      The order of file being added is (top to bottom):

      [1]

      ---------------------------------------------

      GrantApplicationForm.3214.pdf
      draftDisbursementLetter1.pdf
      draftPaymentVoucher1.pdf
      finalDisbursementLetter1.pdf
      finalPaymentVoucher1.pdf

      ---------------------------------------------

       

      but when I see in the attachment tab, the order is:

      [2]

      ---------------------------------------------

      GrantApplicationFormFTS000908000017.3214.pdf
      draftDisbursementLetter1.pdf
      finalPaymentVoucher1.pdf
      finalDisbursementLetter1.pdf

      draftPaymentVoucher1.pdf

      ---------------------------------------------

       

      I have tried with a custom component to list the file name, it still display correct order, i.e. as [1].

       

       

      Do I miss out any thing or can you let me know what ordering of attachments that Livecycle is using?

       

      Thank you,

      Anh

       

      P.S.

      When it first add 3 document, i still see it displays correctly. i.e.

      [3]

      ---------------------------------------------

      GrantApplicationForm.3214.pdf
      draftDisbursementLetter1.pdf
      draftPaymentVoucher1.pdf

       

      ---------------------------------------------

       

      But when adding 2 more documents, the ordering is very strange as [2]

        • 1. Re: Document ordering in attachment tab
          vu.tuan.anh Level 1

          I tried to download the 5 documents and try sorting with windows, i realized that if I download 1 by 1 by the order:

           

          GrantApplicationForm.3214.pdf
          draftDisbursementLetter1.pdf
          finalPaymentVoucher1.pdf   
          finalDisbursementLetter1.pdf
          draftPaymentVoucher1.pdf  

           

          and sort by accessed time, I will have the order as [2].

           

          i.e.

           

          GrantApplicationFormFTS000908000017.3214.pdf (6:58:18/6:58:18/6:58:46)
          draftDisbursementLetter1.pdf (6:58:18/6:58:25/6:58:25)
          finalPaymentVoucher1.pdf    (6:58:18/6:58:28/6:58:28)
          finalDisbursementLetter1.pdf (6:58:18/6:58:30/6:58:30)
          draftPaymentVoucher1.pdf    (6:58:18/6:58:32/6:58:32)

           

          The timing are created/modified/accessed in order.

           

          I don't know why it sort by accessed time or it is just a coincident ...

           

          Regards,

          Anh

          • 2. Re: Document ordering in attachment tab
            vu.tuan.anh Level 1

            Hi,

             

            I realize that the order of document list in attachment tab is changed every time the form is escalated.

             

            I.e. from user A, order of 5 documents can be 1, 2, 3, 4, 5

            when escalate to user B, order will change to 1, 3, 4, 2, 5 and so on ...

             

            Is this the default behaviour of livecycle User Task or can it be improved in next version, i.e. display in order because the attachmentList is List type, not Set type?

             

            Regards,

            Anh

            • 3. Re: Document ordering in attachment tab
              vu.tuan.anh Level 1

              I know how to solve already.

               

              In every User Task, I need to specify output attachment list to /process_data/@attachmentList[1] to make the order unchanged.

              Previously I don't set the output of attachment list and the order of attachment list between 2 consecutive task will be changed randomly each time.

               

              This is still not a perfect solution because originally I don't want what user changes in the attachment list to be escalated to next user.

               

              Regards,

              Anh