Page 1 of 1

Update SQL Record On Successful Upload

Posted: Wed Nov 11, 2020 5:24 pm
by jimbo
Hi,

I'm looking at different use cases for Syncovery, is there a way i can get it to update a SQL record?

There is a pre-existing MS table which logs outgoing files and their names, where i need to update the datetime the file has been uploaded.

Thanks in advance

Re: Update SQL Record On Successful Upload

Posted: Wed Nov 11, 2020 8:18 pm
by tobias
Hello,
yes, you can implement an OnUploadComplete PascalScript hook that executes a command line tool to update your database.

For example:

Code: Select all

function OnUploadComplete(const FileName, LocalFilePath, CompleteURL: UnicodeString;
        const isRightSide:Boolean;
        const FileSize:Int64;
        const Connector: Opaque):Boolean;
begin
  Execute('C:\Tools\UpdateTable.bat "'+FileName+'"',120);
  Result:=true;
  end;
See also
https://www.syncovery.com/pascalscript/

Re: Update SQL Record On Successful Upload

Posted: Thu Nov 12, 2020 8:44 am
by jimbo
Perfect thanks will give it a go

Re: Update SQL Record On Successful Upload

Posted: Thu Nov 12, 2020 12:06 pm
by jimbo
Hi, It doesnt seem to trigger when using OnUploadComplete.

I can get it to trigger when using OnProfileResults but that doesnt run for each file or contain the filename.

The Sync operation mode im using is Move Files To Desitnation, any idea if theres a way to trigger it for each file?

Thanks in advance

Re: Update SQL Record On Successful Upload

Posted: Thu Nov 12, 2020 3:31 pm
by tobias
Are you actually uploading using an Internet Protocol or just copying between normal Windows paths?

Re: Update SQL Record On Successful Upload

Posted: Thu Nov 12, 2020 3:45 pm
by jimbo
Ah ha, during testing i was just moving to antoher windows folder.
Works great now thanks for your support.