14 Replies Latest reply: Dec 29, 2011 11:56 AM by ECLCArchitect RSS

    Send With Map of Attachments & Map Variable

      I'm trying to send multiple attachments using "Send With Map of Attachments" Service.  I've setup a map variable (attachments_map) of sub-type string to hold the path and file name for each file (represented as <full_path>/<file_name>.pdf).<br /><br />What I'm confused about is that I don't understand the keys of the map given the following statement in the help file about this specific Email service: "The keys for the map are the attachment file names. The file names should include the file name extension if the email receiver needs to associate the file with software to open it."<br /><br />I have two questions:<br /><br />1)  What are the keys for the map needed for the "Send With Map of Attachments" service for Attachments and what is the XPath representation to send this data to the service (e.g., /process_data/attachment_map/@file[0] or /process_data/attachment_map/@file[<file_name>] or what) ?  I don't know what the required XML structure looks like.  As you can tell, I've not used a map variable before either!  :)<br /><br />2)  As in the "Send With Document" service, is there a way to define the file name saved in the e-mail that the receiver sees?<br /><br />Example:<br />Receiver sees this in e-mail:  "File.pdf"<br />But the path and file are actually this:  T:/Files/XXXX_File.pdf<br /><br />Thanks for your help in advance!
        • 1. Re: Send With Map of Attachments & Map Variable
          Jasmin Charbonneau techies
          When you use the "Send With Map of Attachments", the map you provide need to be a map of "document" and not string.

          Each document element in the map contains the content of the file you want to attach and the corresponding key contains the name of that attachment.

          Does that make more sense?

          Jasmin
          • 2. Re: Send With Map of Attachments & Map Variable
            HowardTreisman Community Member
            Hi Wade
            As Jasmin says, if you're passing a Map variable explicitly, the key contains the name of the file as it will be displayed to the end user, and the map value contains a Document. Note that it MUST be a document, not the path to a document. If your file lives on the file system, you'll have to use the File utilities to read it into a document.

            Your xpath (using SetValue) to set the map will look something like this (from memory, I may get something wrong)...
            /process_data/mymap[@id="File1.pdf"] = /process_data/@document1
            /process_data/mymap[@id="File2.pdf"] = /process_data/@document2
            (etc, as needed)

            However, if you use a literal, rather than a map variable, things get much easier. There is an "interpretation" column that allows you to directly refer to a file on the file system, among several others. The user interface should hopefully make this obvious.

            I hope this helps...

            Howard
            http://www.avoka.com
            • 3. Re: Send With Map of Attachments & Map Variable
              HowardTreisman Community Member
              PS Actually, SendWithMap actually handles several types of map value in addition to Document. It will also handle Strings, XML Documents, and binary variables.
              So the following are all valid:
              /process_data/mymap[@id="File1.xml"] = /process_data/myxmlvar
              /process_data/mymap[@id="File2.txt"] = "Hello world"
              /process_data/mymap[@id="File3.jpg"] = /process_data/@mybinaryvar

              In the case of a String, it will send the string itself. It will NOT interpret the String as a filepath.

              Howard
              • 4. Re: Send With Map of Attachments & Map Variable
                Community Member
                How do I extract multiple documents from DB, does the Query Multiple rows return objects of type documents?
                • 5. Re: Send With Map of Attachments & Map Variable
                  Thanks for your help, Howard! Additionally, Im querying a DB that can provide up to 10 attachment locations/file (e.g., T:/Files/XXXX_File.pdf) that need to be brought into a single e-mail. If I map this information to a map variable of type string, you stated In the case of a String, it will send the string itself. It will NOT interpret the String as a filepath.. How would I be able to point/upload (reiteratively) to get the file(s) into the map to work with SendWithMap?

                  Again, I really appreciate your help on this!

                  Wade.
                  • 6. Re: Send With Map of Attachments & Map Variable
                    parth pandya Community Member
                    Hi Wade,

                    I think you should use Read Document operation from Foundation->FileUtitilies and read the file content into the map.
                    • 7. Re: Send With Map of Attachments & Map Variable
                      HowardTreisman Community Member
                      Hi Wade
                      A very simple way to achieve this is to use a component called CollectionUtils which will do that in one operation: readMultipleDocumentsToMap.
                      You can find the docs here: http://avoka.dnsalias.com/confluence/display/Public/Collection+Utilities+DSC
                      You can download here: http://www.avoka.com/apps/checkcookie?location=/apps/qpacdownload&qpac=y&qpac_code=avokaE SComponents
                      Howard
                      • 8. Re: Send With Map of Attachments & Map Variable
                        FINALLY figured this out! I configured a map variable of sub-type document called "attachment_map". I have the files that are to be attached stored in a database, and I used the component Query for Multiple Rows to get the attachment data into an XML document. I then built an iterative process loop to parse the XML (using the NodeSet functions count() and position() to control this) loading the file name for each file (the map key) into the process variable "attachment_file_name" and the full file path and name into another variable "attachment_file_full_path". The process loads the documents (one at a time) into the map variable using the Foundation file utility Read Document - the input variable is /process_data/@attachment_file_full_path and the output variable is /process_data/attachment_map/[@id=/process_data/@attachment_file_name]. After the map is loaded with all the attachments I wanted, I used the Send With Map of Attachments component with /process_data/attachment_map/ as my Attachments variable. As long as the file names are unique, they all came through.
                        • 9. Re: Send With Map of Attachments & Map Variable
                          Hi

                          I want to do something very similar to this. I have my file attachements stored in a list(attachmentList), and I want to create a process that iterate through the list and populate the map(documentMaps).
                          The statement that I have in location (in Mappings) is "/process_data/documentMaps[concat("Doc",/process_data/@currentDoc)] and the statement in expression is "/process_data/attachmentList['/process_data/@currentDoc']".

                          I do get the error message "Invalid location: /process_data/documentMaps[Doc1] cannot be stored for action instance: 2326

                          Could someone tell me how can I correct this?

                          Thanks
                          • 10. Re: Send With Map of Attachments & Map Variable
                            HowardTreisman Community Member
                            I think you need extra quotes around the discriminator in your xpath expression.
                            ie.
                            /process_data/documentMaps['concat("Doc",/process_data/@currentDoc)']
                            Can't remember for sure, don't have a running system right now to test.
                            Howard
                            • 11. Re: Send With Map of Attachments & Map Variable
                              $Nith$ Community Member

                              I'm facing the same problem.. Did you find any solution for that??

                               

                              Nith

                              • 12. Re: Send With Map of Attachments & Map Variable
                                Balaji Gurumurthy Community Member

                                hi,

                                     Am facing a problem in ES2. The attachments in the workspace are been recieved on the List variable provided in the ES2 Workbench. But when u consider "Send With Map of Attachments" email service - only Map variables can be specified.

                                How to overcome this situation ..?Should we convert List to Map ..? if yes can u pls provide me how to do this ....

                                Help me on this issue ..

                                 

                                thanx

                                Balaji

                                • 13. Re: Send With Map of Attachments & Map Variable
                                  Jasmin Charbonneau techies

                                  You would probably have to convert the list into a map variable.

                                   

                                  Jas

                                  • 14. Re: Send With Map of Attachments & Map Variable
                                    ECLCArchitect

                                    Jasmin, how do you convert a list into a map?