Hugo,
 
Your post got me thinking: How can you determine if the file contents
have changed?  I have wanted to create something like this for a
while... so I just wrote this SQL Server 2000 function that returns the
checksum of an attachment field (actually any field of Image data type.
The current and new values could be compared to see if it changed.  You
can also use this to find duplicates in the attachment fields in your
system.
 
CREATE FUNCTION dbo.udf_GetImageChecksum
(
 @ImageField IMAGE 
)
RETURNS INT
AS
BEGIN
 DECLARE @Len BIGINT,
   @Pos BIGINT,
   @CheckSum VARCHAR(8000)
 
 SET @Len = DATALENGTH(@ImageField)
 SET @Pos = 1
 SET @CheckSum = ''
 
 WHILE @Pos < @Len
 BEGIN
  
  SET @CheckSum = @CheckSum + CONVERT(VARCHAR,
BINARY_CHECKSUM(SUBSTRING(@ImageField, @Pos, 8000)))
 
  IF LEN(@CheckSum) > 7900
   SET @CheckSum = CONVERT(VARCHAR, CHECKSUM(@CheckSum))
 
  SET @Pos = @Pos + 8000
 END
 
 RETURN CHECKSUM(@CheckSum)
END
 
In a Set Fields SQL command:
 
SELECT dbo.udf_GetImageChecksum(c536880912)
FROM b611c536880912
WHERE entryId = 'ATTACH000016929'
 
 
HTH someone.
 
Stephen

________________________________

From: Action Request System discussion list(ARSList)
[mailto:[EMAIL PROTECTED] On Behalf Of Hugo Visser
Sent: Thursday, August 02, 2007 5:15 AM
To: arslist@ARSLIST.ORG
Subject: Re: Attachement Updation


** You cannot compare the file contents, but using TR you should be able
to detect that a file was attached again (if the DB value wasn't
$NULL$). The "value" contains the file size in bytes, the compressed
size in the DB and the full filename on the client. 

Also note that user cannot change the attachment from the attachment
field without re-attaching it. Just changing the attachment
(open->edit->save) doesn't update the DB, it only updates the local
temporary copy of the file. 

Hugo


On 8/2/07, Meenakshinathan <[EMAIL PROTECTED]> wrote: 

        Hi Robert,
        
        Thanks for the information.
        
        Anyhow this solution is not working. Remedy stores the
attachments in
        the following way <number of characters>,<no of bytes>(i am
sure. but
        it might bytes),<filename with extenstion>. 
        
        I am not user this TR and DB can apply for attachement fields.
        
        can any one give me a alternative solution on this? Looking for
your
        inputs.
        
        Thanks,
        Meenakshinathan
        
        
        On Jul 28, 2:36 am, Robert Halstead < [EMAIL PROTECTED]>
wrote:
        > I'm not entirely sure on this, but couldn't you do a filter on
modify
        > with a run-if condition as: 'TR.Attachment' != '
DB.Attachment' ??  I'm
        > not entirely sure how remedy stores the attachments.  It might
        > work....
        >
        > Anyone else ??
        >
        > On 7/27/07, Meenakshinathan < [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> > wrote:
        >
        > > Hi Listers,
        >
        > > In my application, at first stage users can attach 3-4
files. when the
        > > request assinged to next stage, that next stage user can
edit or 
        > > modify the attachment and can upload it again. In this stage
my client
        > > has an requirement like, first stage user to be notified
whenever any
        > > attachement is updated. If anybody came throrough this , can
you 
        > > please let me know how do i implement this?
        >
        > > Thanks,
        > > Meenakshinathan
        >
        > >
________________________________________________________________________
___-____
        > > UNSUBSCRIBE or access ARSlist Archives
atwww.arslist.orgARSlist:"Where the Answers Are"
        >
        > --
        > "A fool acts, regardless; knowing well that he is wrong. The
ignoramus
        > acts on only what he knows, but all that he knows. 
        > The ignoramus may be saved, but the fool knows that he is
doomed."
        >
        > Robert Halstead
        >
        >
________________________________________________________________________
___-____
        > UNSUBSCRIBE or access ARSlist Archives
atwww.arslist.orgARSlist:"Where the Answers Are"
        
        
________________________________________________________________________
_______
        UNSUBSCRIBE or access ARSlist Archives at www.arslist.org
ARSlist:"Where the Answers Are"
        


__20060125_______________________This posting was submitted with HTML in
it___

_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org ARSlist:"Where the 
Answers Are"

Reply via email to