12 Replies Latest reply on Apr 26, 2009 5:51 AM by HowardTreisman

    Adding List to Map

      I am trying to add a list to a map ,but iam getting the following exception

      Caused by: java.lang.RuntimeException: Cannot create a map entry without a key specified.

      Here is the pieced of xpath iam using in the service

      Location : /process_data/mapofConvertedPdfs[@id='listOfConvertedPdfs']
      Expression : /process_data/convertedListofPdfs

      mapofConvertedPdfs is the map which has subtype as document
      convertedListofPdfs is the list which has subtype as document

      can anyone please help me to get this resolved
        • 1. Re: Adding List to Map
          Level 1
          if you want to assign all the documents in the list to a map of documents I do not think you can do it in one xpath expression.You need to create a key for every document in the list and then add each document of the list.You would definately need to do some looping If your list has only one document then you can use the xpath expression
          /process_data/convertedListofPdfs[1] in the expression side if the equation.
          • 2. Re: Adding List to Map
            Jasmin Charbonneau Level 4
            If you really want to add the list object to the map (and not retrieve the individual document out of the list), then mapofConvertedPdfs needs to be subtype List and not document since you're adding a list to the map and not documents.

            If you want to end up with a map of all the documents that are contained by the list then WorkflowUser is right, you'll have to do that manually.

            • 3. Re: Adding List to Map
              deepusrp Level 1



              Even i have the same problem...


              how can we do it manually, if the list length is unknown.  My task is to extract the attachments attached to the pdf form into a list.  I'll not be knowing howmany attachemnts are there on the pdf form.  after extraction i need to send all the documents as email attachments.


              how can i do that.





              • 4. Re: Adding List to Map



                You have to loop throug the list and add the document one by one to the map. One more thing make sure the sub-type of map is document.


                It should be three setvalue component.


                (a) Initialize the Loop:


                /process_data/@listCount = count(/process_data/list) ----- listCount is a variable of type int

                /process_data/@currentIndex = 1 -------- currentIndex is a varibale of type int


                (b) Get Current Document from List:


                /process_data/@docAttach =   /process_data/list[/process_data/@currentIndex] --------------- docAttach is a varibale of type document

                /process_data/@docName =  getDocAttribute(/process_data/@docAttach, "wsfilename")  -------- docName is of type string

                /process_data/@docDesc = getDocAttribute(/process_data/@docAttach, "wsdescription")  --- docDesc is of type string


                (c) Assign it to Map:


                /process_data/mapDoc[@id=/process_data/@docName] = /process_data/@docAttach --- mapDoc is a map subtype document

                /process_data/@currentIndex = /process_data/@currentIndex + 1


                You have to make a condition in the Assign Map route to the Get Current Document from list.


                /process_data/@currentIndex <= /process_data/@listCount




                • 5. Re: Getting Attachments from PDF
                  waqas.rehman Level 1



                  To extract the attachments you have to use assembler service to get the attachments from the PDF document. following is the sample DDX file that you can use to:


                  <?xml version="1.0" encoding="UTF-8"?>
                  <DDX xmlns="http://ns.adobe.com/DDX/1.0/">
                  <FileAttachments result="attachmentInfo.xml" nameKeys="*" extract="true">
                  <PDF source="fileIn1"/>
                  <FilenameEncoding encoding="ISO-8859-1"/>





                  • 6. Re: Adding List to Map
                    deepusrp Level 1

                    Hello Rehman,


                    Thanks a lot for ut detailed reply.


                    I did not understand your latest mail... i tried the method mentioned on the old mail


                    Now I tried  for one document.


                    I was very happy to see the attachement on the mail.


                    But the problem is when i tried to attach an image file, the image file came as an attachment, but when i tried to open, file opened but no image!!  Samething happened with a text file, when i tried to open the text file on the attachment there was some crappy data istead of the actual data.




                    Please guide me why this is happening...




                    • 7. Re: Adding List to Map
                      waqas.rehman Level 1



                      Kindly explain me in detail what your process is doing. Are you sending PDF form with attachment in an email to the customer at the end of the workflow?


                      How otherattachment variable is filed? Try to use variable logger to check what is inside the varibale. You can also send me you livecycle archive file.




                      • 8. Re: Adding List to Map
                        deepusrp Level 1

                        Hello Rehman,


                        Lets say I have three users A, B and C in the process, When the process starts some form will be displayed and A fills it and submits.  It goes to B, he will attach some documents (could be jpeg, txt, pdf or anything) and submits the form.  Now the flow has to extract all the documents attached to the pdf and it has to mail to C.  While emailing, it has to attach all the documents along with the pdf form.


                        Right now I have implemented it for one attachment.


                        Let me explaing the steps i followed:


                        1.  Created 2 process variables

                             OtherAttachmentsList      - Type list - subtype Document

                             OtherAttachmentsMap     - Type map - subtype Document


                        2.  On the Assign task, under Attachments and Notes, I have set the output attachment variable to OtherAttachmentList


                        3.  Before renderPDF, on the Setvalue control i have assigned OtherAttachmentsMap = OtherAttachmentsList.

                             I have done as you have instructed. (using docAttach, getting filename ...)


                        4.  On the SendWithMapofDocuments control, under attachments, i have set the attachment variable as OtherAttachmentsMap


                        Now my problem is, I'm getting attachment on the email but the content is not proper.  Can there be any problem with the mime type or the encoding standards?  Or am i missing any configurations?


                        Since it is company related project i cant send u the .lca file.  Please dont mind.  And I have not understood about that DDX File. I'm a newbee.


                        Please guide me



                        • 9. Re: Adding List to Map
                          deepusrp Level 1

                          Can any body please guide me...

                          • 10. Re: Adding List to Map
                            Jasmin Charbonneau Level 4

                            I'm not sure about the step where you set the content of the map to be the content of the list :  OtherAttachmentsMap = OtherAttachmentsList.


                            If you manually populate a map with two elements, do you get both attachments properly?



                            • 11. Re: Adding List to Map
                              deepusrp Level 1

                              Hello Jasmin,


                              No i'm not getting properly for even one element on the map.


                              i'm doing like this:


                              /process_data/@docAttach =   /process_data/list[1] --------------- docAttach is a varibale of type document

                              /process_data/@docName =  getDocAttribute(/process_data/@docAttach, "wsfilename")  -------- docName is of type string

                              /process_data/@docDesc = getDocAttribute(/process_data/@docAttach, "wsdescription")  --- docDesc is of type string


                              ********Assign it to Map:************


                              /process_data/mapDoc[@id=/process_data/@docName] = /process_data/@docAttach --- mapDoc is a map subtype document


                              I'm getting document in the email but not the exact data.  If u send text file some crappy text file will come, and if u send some image file there will be no image on the email.  But the filename everything would be same.  what could be the problem?



                              • 12. Re: Adding List to Map
                                HowardTreisman Level 1


                                The easiest way to do this is using our CollectionUtils component.

                                Info here:http://avoka.dnsalias.com/confluence/display/Public/Collection+Utilities+DSC

                                Download here:http://www.avoka.com/avoka/escomponents.shtml