File Mover Blog

  • 04 Oct

    Weather reading using REST API in LimagitoX File Mover

    Weather reading using REST API in LimagitoX File Mover

    In this example we’ll show you how to get weather information as JSON using a REST API call.

    >Select REST as Source:
    LimagitoX File Mover REST as Source

    >REST as Source Setup:

    We’ll use an API from openweathermap.org

    https://api.openweathermap.org/data/2.5/weather?appid={openweathermap_apikey}&q=chicago

    More information here.

    LimagitoX File Mover REST Setup

    >Select WIN as Destination:

    LimagitoX File Mover WIN as Destination

    >RunTime Log Result

    LimagitoX File Mover RunTime Log Rest Result

    >Destination File

    LimagitoX File Mover REST destination file

    >Content Destination File opened using Notepad++

    >Content Destination File opened in Notepad++ and its JSON Plugin

    The next step could be a conversion from JSON to another format, many options are possible. This is just an example to show you what can be done with REST as Source in LimagitoX File Mover.

     

    If you need any help with this REST Weather reading API Call setup, please let us know.

    Best Regards,

    Limagito Team

     

    >> Notepad++ Hint, installing the JSON Plugin <<

     

    By Limagito-Team REST
  • 03 Oct

    Looking for a File Mover Software to accomplish Archiving task

    Q: Looking for Software to accomplish Archiving task.

    Details: Looking for product that we can schedule to look at multiple project folders within a base directory, if no files have been modified in X days within a project folder, then move (copy/delete) that whole project directory and files to another server/CIFS location. Even better if that product can append a string (like date) to the moved project folder for reference ( if possible append 10_02_2020 to end of projectX folder name). Essentially we want to automate archiving data from expensive location/storage to cheap location/storage.

    A: In version v2020.10.3.0 we added some Pascal Script functions to achieve this request.

    What we will do is:
    – Scan base directory for project folders (1 level deep) using Pascal Script
    – Scan each project folder we found for the youngest filedate
    – If youngest filedate in this folder is older than x days then we add this folder to a parameter (%VSA)
    – At the end we provide this parameter (%VSA) as WIN Source. This parameter can containe multiple project folders.
    – The renaming of the Destination will be done in the WIN Destination Setup with a little help of Pascal Script

    Some screenshots to get you started:

    >Please Select WIN as Source and change the ‘Select Directory’ to %VSA.

    So as you see the WIN as Source will NOT be your project base folder! Parameters in LimagitoX File Mover start with %. %VSA stands for Variable String A. %VSA can be used at different places in the rule setup. In this case %VSA will get its value using Pascal Script.


    LimagitoX File Mover WIN as Source

    > Select ‘Pascal Script’ Setup in the ‘Moving Rule’ menu:

    LimagitoX Pascal Script

    >Enable and add the following ‘On Rule Begin’ Pascal Script:

    Important, change the following Const in the Pascal Script:

    • ctSourcePath = ‘C:\Test\In\’;
    • ctOlderThanInDays = 1000;

    ctSourcePath is the base directory of your Project Folders.

    ctOlderThanInDays is set to 1000. So in this case the youngest file should be older then 1000 days before we move the project folder and its content.

    Var
      iPath: Integer;
      tmpFileDate: TDateTime;
      tmpFileName: String;
      tmpPath: String;
      tmpPaths: TStringList;
    Const
      ctSourcePath = 'C:\Test\In\';
      ctOlderThanInDays = 1000;
    Begin
      // Init Var
      psExitCode:= 0;
      psVSA := '';
      // ... add your code here
      psLogWrite(1, '', 'PS Source File Path: ' + ctSourcePath);
      tmpPaths := TStringList.Create;
      Try
        // psListPaths(Directory: String; DirectoryFilter: String; DirectoryLevel: integer; Var Paths: TStringList);
        psListPaths(ctSourcePath, '*', 1, tmpPaths);
        psLogWrite(1, '', 'PS Folders Found: ' + tmpPaths.Text);
        // Iterate
        For iPath := 0 To (tmpPaths.Count-1) Do
        Begin
          tmpPath := tmpPaths.Strings[iPath];
          // psGetYoungestFilename(Directory: String; FilenameFilter: String; IncludeSubDirectory: boolean): String;
          tmpFileDate := psGetYoungestFileDate(tmpPath, '*.*', True);
          If tmpFileDate <> 0 Then
          Begin
            // Debug Info
            tmpFileName := psGetYoungestFilename(tmpPath, '*.*', True);
            psLogWrite(1, '', 'PS Youngest Filename Found: ' + tmpFileName + ' in ' + tmpPath);
            // Check Date
            If tmpFileDate < (Now - ctOlderThanInDays) Then
            Begin
              // Add Patht to psVSA Param
              If psVSA = '' Then
                psVSA := tmpPath + ';'
              Else
                psVSA := psVSA + tmpPath + ';';
            End;
          End;
        End;
        // Debug Info
        psLogWrite(1, '', 'PS Path Count: ' + IntToStr(tmpPaths.Count));
      Finally
        tmpPaths.Free;
      End;
      // Check Result
      If psVSA <> '' Then
      Begin
        psLogWrite(1, '', 'Pascal Script psVSA Result: ' + psVSA);
        psExitCode := 1;
      End
      Else
        psVSA := 'C:\NonExistingPath\';
    End.
    

    >Enable and add the following ‘On Destination’ Pascal Script

    Important, change the following Const in the Pascal Script:

    • ctSourcePath = ‘C:\Test\In\’;

    ctSourcePath is the base directory of your Project Folders. Must be exactly the same as in the previous ‘On Rule Begin’ Pascal Script.

    This Pascal Script will strip the root part of the Project Folder and set it to %VSB. We’ll use %VSB later for adding the date as requested to the root folder of the project.

    LimagitoX Pascal Script On Destination

    Const
      ctSourcePath = 'C:\Test\In\';
    Begin
      psExitCode:= 1;
      // ... add your code here
      psVSB := psStringReplace(psSourcePath, ctSourcePath, '');
      psVSB := psStringReplace(psVSB, '\', '');
      psLogWrite(1, '', 'psVSB: ' + psVSB);
    End.
    

    >Select ‘Add WIN’ in the Destination Setup:

    LimagitoX File Mover Select Destination

    >Select your Destination folder (= where to move the project folders to):

    LimagitoX File Mover WIN as Destination

    >Enable and set ‘Create Subdir, opt.’ to:  %VSB_%TCD:MM_DD_YYYY:\%SFS

    LimagitoX File Mover Subdir option

    > Function setup, please leave the Function to ‘Copy Files’ during your tests. If everything is ok then you can change it to ‘Move Files’.

    LimagitoX File Mover Function Setup

    > Done

    If you need any help with this Archiving task setup, please let us know.

    Best Regards,

    Limagito Team

  • 27 Sep

    REST as Source was added to LimagitoX File Mover

    REST as Source was added in LimagitoX File Mover version v2020.9.27.0

    This was done on request by a customer who wanted to use our File Mover to download HL7 results using REST.

    LimagitoX File Mover REST as Source

    In the screenshot we seleceted ‘Quest HL7 Results’ as Web Service API and added the Request Url:

    The JSON Request field stays empty, this is only used when you select Custom as Web Service API.

    LimagitoX File Mover REST Setup

    Don’t forget to add the Acknowledgment Url (not the same as the Request Url):

    LimagitoX File Mover REST Ack Setup

    REST Security Setup:

    LimagitoX File Mover REST Security Setup

    REST Common options:

    LimagitoX File Mover REST Common options

    REST RunTime Log

    LimagitoX File Mover REST RunTime Log

    If you need any help with the REST as Source option, please let us know. We are interested in adding your ‘custom’ REST API.

    Best regards,

    Limagito Team

    By Limagito-Team HL7 REST ,
1 84 85 86 87 88 89 90 145
SEARCH