Welcome Guest! Log in


The forum is in read only mode.
Stambia versions 2.x, 3.x, S17, S18, S19 and S20 are reaching End of Support January, 15th, 2024. Please consider upgrading to the supported Semarchy xDI versions. See Global Policy Support and the Semarchy Documentation.

The Stambia User Community is moving to Semarchy! All the applicable resources have already been moved or are currently being moved to their new location. Read more…

Topic-icon Question check flat file contain any records or not

16 Nov 2016 15:22 #1 by Prashant.Sangle
check flat file contain any records or not was created by Prashant.Sangle

I want to check that file contain records or not, before move action perform.
If 0 records then send alert mail else proceed to next action.

16 Nov 2016 17:14 - 16 Nov 2016 17:18 #2 by Cyril Dussud
Replied by Cyril Dussud on topic check flat file contain any records or not

I see different solutions to perform this:

1. If your file is supported by Stambia (Delimited/Positional, ...) you could simply perform a select on the file with a SQL Operation and check the number of results through a bind link.
For instance:

-> The caveat of this is that all the rows of the files are read

2. You could also make a little script that test the length of the file
For instance:

In this example, we are testing that the file exists, and then its length.
The script is:
File file = new File("${../filePath}$");

if (file.exists()) {
	if (file.length() == 0){

We are using then the variable we have published to split our Process, with conditions like
"${~/fileStatus}$" == "EMPTY"

I hope this answers to your question.:)
Last edit: 16 Nov 2016 17:18 by Cyril Dussud.