6 Replies Latest reply on Aug 6, 2014 12:06 PM by Steve Ghost

    Viewing attachment from a View form

    Karthick Krishnan

      Hi All,


      As per BMC guide, attachment field is not supported in View form.


      Is there any alternate method to acheive the same in remedy?


      This should be accomplished without using api, as the data is to be fetched from an archived BxxxCyyyyy table which is out ARS's control.


      Thanks in Advance


        • 1. Viewing attachment from a View form
          Misi Mladoniczky



          The data is compressed within the BLOB, and the compression method is not a public thing.


          In theory, you should be able to read the BLOB into an ARFieldStruct from the BxxxCyyyyy table, and set the Original/Compressed sizes and file name from the Bxxx table.


          Try creating a filter plugin that populates a display-only attachment field for you with these values. I have not tested this, but hopefully the API will know that when the buffer has the same size as the compressed size, it needs to be uncompressed...


                  Best Regards - Misi, RRR AB, http://rrr.se

          • 2. Viewing attachment from a View form
            Karthick Krishnan

            Hi Misi,


            Thanks for the information.


            Since i have the attachment table in a different database other than the arsystem database, I tried to read the attachment data from the DB using a java program(without using remedy api). But, as you mentioned its showing some encrypted data.


            Is there any way to decrypt/uncompress the same using remedy api?


            If so, what is the method and the structure to hold the same.




            • 3. Viewing attachment from a View form
              Misi Mladoniczky



              That was what I suggested originally.


              1. Call the filter plugin

              2. The filter plugins retrieves the data from your external source

              3. The filter plugin assigns the retrieved data to an attachment field

                BLOB -> Buf

                OrigSize -> OrigSize

                CompSize -> CompSize

                Name -> Name

              4. The filter plugin returns the attachment field


              I have not looked at the Java API, but presumably the same kind of attributes are available there...


              I am suggesting a filter plugin, as these are easier to program than ARDBC plugins, but that might be an option. You must run something that has access to the API.


                      Best Regards - Misi, RRR AB, http://rrr.se

              1 of 1 people found this helpful
              • 4. Viewing attachment from a View form
                Karthick Krishnan



                I have tried the following using a simple java api program.


                1. Read the data from the database BxxxCyyyyy table and assign it to AttachmentValue


                • AttachmentValue av1=new AttachmentValue(rs.getBytes(2));


                2. Put it on the Entry e1, and save the request


                • e1.put(536870914,new Value(av1));
                • asu.createEntry("kkArcAttRetreive", e1);


                I am getting the below error

                ERROR (102): Message not in catalog; Message number = 102



                Any idea on this error and how to proceed with this?

                • 5. Viewing attachment from a View form
                  Misi Mladoniczky



                  I am no expert on the Java API, but that will definitely not work.


                  You need to be able to directly access the following which you CAN set in the C-API:

                  - Buffer (the data from the BLOB)

                  - Name (of the attachment from the BXXX table)

                  - OrigSize (from BXXX table)

                  - CompressedSize (from BXXX table)


                  It is not 100% sure it will work anyway, but in the normal client C-API I think that this would be taken care of. I am assuming that the same will be true if you assign a compressed buffer in the filter API if you also supply the OrigSize and CompressedSize parameters. Or maybe it should work without the Size-attributes if those values are somhow stored within the header of the compressed BLOB...


                          Best Regards - Misi, RRR AB, http://rrr.se

                  • 6. Re: Viewing attachment from a View form

                    as a note, its possible to deduce the compression algorithm they used (its not all that complicated...)..
                    Here is a java class to decode it...
                    [Java] Remedy Attachment Converter - Pastebin.com


                    Also attached is a simple program to convert a blob(saved) file and move it to a an uncompressed file..(i.e very basic..more proof of concept then anything else..)