Automated imports setup for Flex.bi server

If you set up automatic periodic export of data from HansaWorld you might want to automatically import them into your flex.bi account. To do that you need to do three things:

  1. Create a folder for the files to be imported from

  2. Ensure that the export files are placed in that folder (by any means available to you)

  3. Change configuration of flex.bi to start checking those folders

Creating folder structure

You need to create one folder import in the root folder of the flex.bi server. This folder then will contain a folder for each flex.bi account you want to perform the automatic import. I.e. you might want to keep some accounts not up to date (historical data) and update others. This is why you need to create a folder for each of the accounts you want to automatically update. Name of each of these folders is the ID of that account. You can find out the ID of an account by looking at the URL when you open that account in the browser.

For example if you see a URL in your browser:

https://flex.bi/bi/accounts/12/source_data#source_files

The ID of this account is 12 and you need to create a folder called 12 under the folder import. So the end result might look something like this:

flexbi_private/import/12

Make sure that these folders have full access right for the server user running the eazybi server as it needs to move and rename the files in the folder.

Moving the data files

There are various ways how to move files from HansaWorld server to flex.bi server and you should consult you IT staff for the best one available for you. Usually this will be done using either an FTP or SFTP server, mounting a folder as a network file system and then moving the files around with a shell or bash script.

The regularity of the file movements should be aligned with how often they are being exported from HansaWorld.

Changing flex.bi configuration

Finally you need to instruct flex.bi server to check the created folder for data files to import. You can do this by editing configuration file:

config/eazybi.toml

You need to add a new or modify the existing configuration block with contents to run every X minutes:

# Add custom regular jobs and specify frequency in "every" or "cron" parameter
[[regular_jobs]]
job = "SourceFile::AutomaticImporter.start_automatic_file_import"
# every = "15m"
cron = "*/15 * * * *"

Make sure you get the indenting right and restart the flex.bi server for the changes to be applied.

You can of course change the regularity of the imports in the normal cron format.