6 Replies Latest reply on May 24, 2013 1:30 AM by dobunzli

    server script and export/import field content (changing the name of a container file)

    dobunzli

      Hello,

      I wish to do a server script that will regulary change the name of files contained in a container field. Problem is the trick I use to change the filename doesn't work as a server script (export the file with desired filename and then reimport it).

       

      Any ideas how to work this around ?

      Thanks in advance

       

      Here is my script:

       

      # set desired file name
      Set Variable [ $file_name; Value:"Labo_BBV_" & Year(Get ( CurrentDate )) & "_" & $no_dossier & ".pdf" ]
      
      # set temporary export path on windows
      If [ Get ( SystemPlatform ) = -2 ]
      Set Variable [ $path; Value:"filewin:" & Get ( TemporaryPath ) & $file_name ]
      
      Else
      
      # set temporary export path on macs
      Set Variable [ $path; Value:Get ( TemporaryPath ) & $file_name ]
      End If
      
      
      # export file to temporary folder with desired name
      Export Field Contents [ Laboratoire_Incoming::labin_blob; “$path” ]
      
      #reimport file into database
      Insert File [ Laboratoire_Incoming::labin_blob; “$path” ]