Import a file by a certain name

0
Hi all, Is it possible to import a file specified by a name? (during batch microflow)   I would like to import a specific name file during batch execution. would you please tell me how to implement it?   Flat File Importer might be the answer, but seems the module specify a file by the directory and file extension(.csv). https://appstore.home.mendix.com/link/app/429/   I really appreciate with any information. Thank you in advance Regards, Yuki
asked
3 answers
2

In the module you mentioned the setup for an on premise deployment where a file can be read form a configurable directory is available and can be re-used in your project.

The function is available from the java code associated to the import actions in the module.

Currently this will read the files based on the extension, but this can be easily changed to a complete file name as you seem to need in your case. And it will be something like this:

String file ="src/test/resources/fileTest.txt";
     
     BufferedReader reader = new BufferedReader(new FileReader(file));

Where the file String variable can be the input variable of your java action.

answered
1

Place a file in the \resource folder of your project.

Use the ‘GetFileContentsFromResource’ action from the CommunityCommons to load the specific file in your microflow.

answered
0

Thank you Erwin’t! That is exactly what I wanted. The module is currently looks like this, and hopefully, I want to use a complete file name for uploading.
Just to confirm, you are suggesting to add a parameter to the prepared java action as the image below, am I right? or I should write an java action you gave from scratch.

answered