How to Avoid an old "Default File" from importing into Anaplan via Anaplan Connect if no file loads?

Here is our setup:

We have an Anaplan import that runs via Anaplan Connect.

The file drops into the folder location daily on the server. Then Anaplan Connect picks up that file & loads it into Anaplan.

Here is our problem: If no file drops into the folder location on the server, then Anaplan Connect will default to an older file (potentially the default file in Anaplan?) and import that data.

The problematic result: This causes us to have old data in the system. Versus, if there is no file, then it should load in no data.

Is there a way to fix this?

We have tried changing the "Default File" setting, but it does not change anything. Nor does it recognize it as a production change.

Tagged:

Best Answer

  • Prajjwal88
    Answer ✓

    Hi @jonathan.edwards,

    As @Stacey_Gibbens suggested, you may need to build some logic in your .bat file. An alternative approach I’ve used is to update only the most recent data file by moving it and renaming it to something like final.csv. Then, in the Anaplan action, you can use final.csv as the import file.

    Here's an example batch script for the same,
    set FilePath="C:\FTP\FOLDER\"
    set FileName_Old="File.csv"
    echo Name_Old: %FileName_Old%
    set FilePath_Old=%FilePath%%FileName_Old%
    set baseName='final'
    set FileName_New=%baseName%.csv
    echo Name_New: %FileName_New%
    set FilePath_New=%FilePath%%FileName_New%
    move %FilePath_Old% %FilePath_New%

    In this way even if the script is scheduled on daily basis then also it will always populate the latest data and so the number will be as same as they looked before upload which is similar to what you're trying to get with no file load.

    I hope this helps.

Answers

  • Hi @jonathan.edwards

    Pretty sure you would need to build some logic into the .bat file to check to see if it sees a file there and only executing the upload/action portion of the script if there is a file. If you write it so that the previous instance of the process deletes the source file after the import is complete, the location would be empty for your next process to check.

    Here's a good resource for windows batch script:

    https://en.wikibooks.org/wiki/Windows_Batch_Scripting#Introduction

    Alternatively, members of your IT Dept may have scheduling tools that can be natively configured to execute only when the file exists. :)

    Good luck!

    Stacey