Pascal Script

  • 05 Jan

    How to remove the header row from a CSV file

    How to remove the header row from a CSV file

    Q: We have a CSV file that contains a header row.  Is it possible for Limagito to remove the first row in the file when we move it to a new folder?  Both the start and ending locations are on a windows server.

    A: Yes, this is possible. Please have a look at the following screenshots.

    • The customer is using a Windows folder as Source so we used this also in our example:

    limagito file mover Windows folder as source

    • We added an include filename filter so we are 100% we’ll only pickup .csv files:

    limagito managedfiletransfer filename filter

    • In our Destination setup we added our ‘Pascal Script’ option:

    limagito managedfiletransfer destination setup

    • Please add the following script (v1): link
    • We also added an alternative for the first script. In this script you can enable or disable the “TrailingLineBreak = finishing line break” (v2): link
      • psSaveListToFile(tmpList, tmpOutputFile, False);
      • psSaveListToFile(tmpList, tmpOutputFile, True);
    • We even added a third possibility where you can change the encoding and BOM of the resulting Csv file (v3): link
    • If you would need a different option, please let us know, many options are possible.

    remove the header row

    • RunTime Log Result:

    remove the header row

    #csv #managedfiletransfer #filetransfer #filemanagement

    If you need any help with this ‘remove the header row’ question, please let us know.

    Best Regards,

    Limagito Team

    By Limagito-Team CSV Pascal Script , , ,
  • 30 Dec

    Split delimited files based on duplicate column

    Split delimited files based on duplicate column

    Q: We receive | (pipe) delimited files (no double quotes):

    Rvman International Inc. – US|CONTENT + US|1310001|0000000122|10/25/2023 1:54 PM
    Rvman International Inc. – US|CONTENT + US|1310002|0000000616|0/25/2023 2:10 PM
    Rvman International Inc. – US|CONTENT + US|1310002|0000000616|0/25/2023 2:10 PM

    Is it possible to create separate files of rows with the same content in column 4?

    The filename(s) would be incremental:

    original .csv

    Rvman International Inc. – US|CONTENT + US|1310001|0000000122|10/25/2023 1:54 PM

    original1.csv

    Rvman International Inc. – US|CONTENT + US|1310002|0000000616|0/25/2023 2:10 PM
    Rvman International Inc. – US|CONTENT + US|1310002|0000000616|0/25/2023 2:10 PM

    Thanks for such a great product!

    A: Yes this is possible using our Pascal Script option

    We used a Windows folder as Source. In this folder we’ll search for .csv files.

    limagito file mover as source

    Since we are only interested in .csv files we added a filename include filter. We want to be sure we’ll only handle .csv files.

    limagito filemover filename filter

    As Destination we used our Pascal Script option. Please replace the default Destination Pascal Script.

    You can download the script: here

    The script will read the csv file with  a pipe as delimiter (this can be adjusted > ctPipe constant). We’ll check the content of column 4 which is index 3 (TStringList = zero index based).

    tmpCol4 := tmpPipe.Strings[3];

    Limagito File Mover pascal script as destination

    Output Result:

    Split delimited files based on duplicate column

    RunTime Log Result:

    limagito file mover runtime log result

    #csv #managedfiletransfer #filetransfer #filemanagement

    If you need any help with this ‘Split delimited files based on duplicate column’ question, please let us know.

    Best Regards,

    Limagito Team

  • 19 Nov

    How to rename a file to include day of the week

    How to rename a file to include day of the week

    Q: I found this in your blog but my filename pattern is different and I don’t know enough of the Pascal language to edit it.

    Here is an example of what I would like to rename.

    Original Filename: 2023-10-24_section_A2.pdf
    (2023-10-24 = October 24, 2023)
    Rename To:  Tues_2023-10-24_section_A2.pdf

    Any help you can provide would be greatly appreciated.

    A: Please have a look at the following example, I guess we need to fine-tune it. Let us know what you think.

    • We used a Windows folder as source:

    limagito file mover windows folder as source

    • Next, open our Pascal Script option:

    limagito file mover paascal script option

    • Enable and add the following ‘On Destination’ Pascal Script:

    You can download the script: here

    limagito file mover include day of the week pascal script

    • We used a Windows Folder as Destination:

    limagito file mover windows folder as destination

    •  Enable ‘Rename Files during Copy/Move’

    limagito file mover file renaming option

    • Renaming Setup:

    RegEx:   (.*)
    Replacement:   %VSA

    limagito file mover file renaming setup

    • RunTime Log Result:

    limagito file mover runtime log result

    #managedfiletransfer #filetransfer #filemanagement

    If you need any help with this ‘include day of the week’ request, please let us know.

    Best Regards,

    Limagito Team

1 2 3 4 5 6 26
SEARCH