Update SQL Record On Successful Upload

English Support for Syncovery on Windows.
Post Reply
jimbo
Posts: 6
Joined: Wed Nov 11, 2020 5:21 pm

Update SQL Record On Successful Upload

Post 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

tobias
Posts: 1639
Joined: Tue Mar 31, 2020 7:37 pm

Re: Update SQL Record On Successful Upload

Post 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/

jimbo
Posts: 6
Joined: Wed Nov 11, 2020 5:21 pm

Re: Update SQL Record On Successful Upload

Post by jimbo »

Perfect thanks will give it a go

jimbo
Posts: 6
Joined: Wed Nov 11, 2020 5:21 pm

Re: Update SQL Record On Successful Upload

Post 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

tobias
Posts: 1639
Joined: Tue Mar 31, 2020 7:37 pm

Re: Update SQL Record On Successful Upload

Post by tobias »

Are you actually uploading using an Internet Protocol or just copying between normal Windows paths?

jimbo
Posts: 6
Joined: Wed Nov 11, 2020 5:21 pm

Re: Update SQL Record On Successful Upload

Post by jimbo »

Ah ha, during testing i was just moving to antoher windows folder.
Works great now thanks for your support.

Post Reply