File Mover Blog

  • 06 Dec

    Q&A 33: Can we create a job to monitor disabled rules

    Q: Monitor disabled rules. Our company purchased Limagito products and used it for several years, and I am very happy to have such a useful product. I want to ask a technical question. Several of our colleagues manage all the built rules together, but sometimes we accidentally turn it off and forget to turn it on. I would like to ask if there is any way to scan all RULES in limagito and find that its status is “Disable”, so we can create a job to monitor this and send a mail to notify us. Looking forward to your help, and wish you all good health.
    A: In version v2020.12.6.0 we added Pascal Script as Source. This new option makes it possible for us to achieve your request. Let’s get started.

    • Select PScript (Pascal Script) as Source:

    Limagito File Mover Pascal Script as Source

    Add the following Pascal Script (Copy / Paste):

    Var
      tmpInfo: String;
      tmpList: TStringList;
    Const
      ctFileName = 'Disabled_Rules.txt';
    Begin
      // Init Var
      psClearSourceFiles; // Clear SourceFiles Listing
      psExitCode:= 1;
      // We'll use a TStringList that we'll fill with Disabled Rules Data
      tmpList := TStringList.Create;
      Try
        Try
          // Function psGetDisabledRuleList(Const aIncGroupname, 
          // aIncRuleName, aIncRuleID: Boolean; Const aDelimiter, aQuoteChar: Char): String;
          // Request for All Disabled Rules using Tab(#9) as Delimiter
          // Include Groupname, RuleName and RuleID
          tmpInfo := psGetDisabledRuleList(True, True, True, #9, #0);
          If tmpInfo <> '' Then
          Begin
            // We'll use psVSA paramter in our email setup later
            psVSA := tmpInfo
            // Add to List
            tmpList.add(tmpInfo);
            // Save List To File
            tmpList.SaveToFile(psRuleTempPath + ctFileName);
            // Add To SourceFiles List
            psAddToSourceFiles(psRuleTempPath + ctFileName);
          End;
        Except
          psLogWrite(1, '', 'Save File ' + psRuleTempPath + ctFileName + ' Exception');
        End;
      Finally
        tmpList.Free;
      End;
    End.
    

    Limagito File Mover Pascal Script Disabled Rules

    — Begin Update Post (15th of January 2023) —

    First le me start by stating how much we enjoy working with your software in past months, Setting it up and configuring the rules was super easy and intuitive.

    We had some issue with tracking rules that were disabled by mistake. After browsing your Q&A I’ve found ‘Q&A 33: Can we create a job to monitor disabled rules’

    Which works great, our only remaining issues is that we have a lot of disabled test rule, the fill the report. Is there a way to generate the same report but to exclude certain rules from it?

    Thank you very much for your kind words. I’ve added an alternative Pascal Script. This will exclude those rules who have the ctExclude word in their description. In my example it would exclude all rule that have the word  “test”  in their description. The ctExlude Const is not case sensitive.
    Var
      iList: Integer;
      tmpEntry, tmpInfo: String;
      tmpList: TStringList;
    Const
      ctExclude = 'test';
      ctFileName = 'Disabled_Rules.txt';
    Begin
      // Init Var
      psClearSourceFiles; // Clear SourceFiles Listing
      psExitCode:= 1;
      // We'll use a TStringList that we'll fill with Disabled Rules Data
      tmpList := TStringList.Create;
      Try 
        Try
          // Function psGetDisabledRuleList(Const aIncGroupname,
          // aIncRuleName, aIncRuleID: Boolean; Const aDelimiter, aQuoteChar: Char): String;
          // Request for All Disabled Rules using Tab(#9) as Delimiter
          // Include Groupname, RuleName and RuleID
          tmpInfo := psGetDisabledRuleList(True, True, True, #9, #0);
          If tmpInfo <> '' Then
          Begin
            // Add to List
            tmpList.Text := tmpInfo;
            // Filter
            For iList := (tmpList.Count-1) Downto 0 Do
            Begin
              tmpEntry := tmpList.Strings[iList];
              If Pos(AnsiLowerCase(ctExclude), AnsiLowerCase(tmpEntry)) <> 0 Then
                tmpList.Delete(iList);    
            End;
            // We'll use psVSA paramter in our email setup later
            psVSA := tmpList.Text;
            // Add to List
            tmpList.add(tmpInfo);
            // Save List To File
            tmpList.SaveToFile(psRuleTempPath + ctFileName);
            // Add To SourceFiles List
            psAddToSourceFiles(psRuleTempPath + ctFileName);
          End;
        Except
          psLogWrite(1, '', 'Save File ' + psRuleTempPath + ctFileName + ' Exception');
        End;
      Finally
        tmpList.Free;
      End;
    End.
    

    — End Update Post (15th of January 2023) —

    It also possible to request all Enabled Rules. In this case you need to replace

    tmpInfo := psGetDisabledRuleList(True, True, True, #9, #0);

    by

    tmpInfo := psGetEnabledRuleList(True, True, True, #9, #0);
    • Add SMTP as Destination:

    Limagito File Mover SMTP as Destination

    • SMTP as Destination  Setup:

    We added %VSA parameter which also contains the Disabled Rule(s). Option ‘Include Source File as Attachment’ is also enabled so the text file containing the Disabled Rule information will be attached to the email.

    Limagito File Mover SMTP as Setup

    • RunTime Log Result:

    Limagito File Mover Pascal Script as Source RunTime Log

    • Received Email Result:

    If you need any help with this ‘job to monitor disabled rules ’, please let us know.

    Best Regards,

    Limagito Team

    By Limagito-Team Pascal Script Q&A ,
  • 04 Dec

    Export Chinese Text Data from SQL server database to CSV file

    Q: I want to export Chinese Text data from an SQL server database to a CSV file. Setting up the Limagito rule was simple: SQL input and an output directory. I am actually using an SQL Select because the data that I want to export results from a join. Unfortunately the exported file is in ANSI encoding. Since my SQL Server source has nvarchar fields, some of them with Chinese text in them, I cannot use the CSV. Is there any way to tell Limagito to output CSV from an SQL Server source as UTF-8?

    A: We had to add some new options in version v2020.12.4 to achieve this.

    We added a basic example to get you started:

    Added SQL as Source

    Limagito File Mover SQL as Source

    We’ll be using a simple QRY to get all the date from a database table:

    Limagito File Mover SQL as Source Select Statement

    We are using a MS SQL Database, connection Setup:

    Limagito File Mover SQL as Source database setup

    Some info about the Database table (Demo_10

    ) we’ll be using:

    Add the query, simple seclect all statement:

    Limagito File Mover SQL as Source Query

    Important, Add the encoding you need. In this example we added UTF-8.

    Limagito File Mover SQL as Source Common options

    Destination Setup, WIN as Destination:

    Limagito File Mover WIN as Destination

    Destination File Result:

    Limagito File Mover SQL to Csv File

    RunTime Log Result:

    Limagito File Mover SQL to Csv RunTime Log

    If you need any help with this ‘Export Chinese Text Data’ question, please let us know.

    Best Regards,

    Limagito Team

    By Limagito-Team SQL , ,
  • 29 Nov

    Q&A 32: Error during sftp file upload with Limagito File Mover

    Q: We have installed Limagito version v2020.11.21.0 with the Site+ license on a W2K19 server. When we try to transfer files to an external sftp server it doesn’t work out fine (Error during sftp file upload). The SSH connection seems fine to me , but the files won’t be uploaded. Unfortunately the other side can’t help me out and I can’t find out what is happening and why.

    25-11-2020 19:39:31 [SFTP] SFTPUploadFile, CK UploadFileByName Error, ChilkatLog:
    
    [SFTP]   UploadFileByName:
    [SFTP]     DllDate: Jul  2 2020
    [SFTP]     ChilkatVersion: 9.5.0.83
    [SFTP]     UnlockPrefix: CPSFTB.CB1062022
    [SFTP]     Architecture: Little Endian; 64-bit
    [SFTP]     Language: Delphi DLL
    [SFTP]     VerboseLogging: 0
    [SFTP]     SshVersion: SSH-2.0-XpertSuite
    [SFTP]     SftpVersion: 4
    [SFTP]     Component successfully unlocked using purchased unlock code.
    [SFTP]     uploadFileByName:
    [SFTP]       remoteFilePath: /XX/XX_2020-11-24_08-00-00-werknemers.xml
    [SFTP]       localFilePath: \\MyDomain\proces\XX_2020-11-24_08-00-00-werknemers.xml
    [SFTP]       localFileSize: 4485
    [SFTP]       sftpOpenFile:
    [SFTP]         remotePath: /XX/XX_2020-11-24_08-00-00-werknemers.xml
    [SFTP]         access: writeOnly
    [SFTP]         createDisposition: createTruncate
    [SFTP]         v3Flags: 0x1a
    [SFTP]         buildLongPath_xFilePath: \\MyDomain\proces\XX_2020-11-24_08-00-00-werknemers.xml
    [SFTP]         Sent FXP_OPEN
    [SFTP]         StatusResponseFromServer:
    [SFTP]           Request: FXP_OPEN
    [SFTP]           InformationReceivedFromServer:
    [SFTP]             StatusCode: 5
    [SFTP]             StatusMessage: Error while parsing request.
    [SFTP]           --InformationReceivedFromServer
    [SFTP]         --StatusResponseFromServer
    [SFTP]       --sftpOpenFile
    [SFTP]       Failed to open file.
    [SFTP]     --uploadFileByName
    [SFTP]     Failed.
    [SFTP]   --UploadFileByName
    [SFTP] --ChilkatLog
    
    25-11-2020 19:39:31 [SFTPPUT] Copy Error \\MyDomain\proces\XX_2020-11-24_08-00-00-werknemers.xml
    

    A: It’s look like the SFTP server is trying to use SFTP Version v4 but .. not correctly. The solution here is to only allow SFTP Version v3.

    FYI: The customer is using our Second SFTP Vendor (CK).

    Limagito File Mover SFTP v3 Only

    Feedback from customer:

    Great !! that did the trick. J J J

    Thanks for your support  !!!

     

    If you need any help with this ‘Error during sftp file upload’, please let us know.

    Best Regards,

    Limagito Team

    By Limagito-Team Error Q&A SFTP , ,
1 70 71 72 73 74 75 76 136
SEARCH