Focal Point
Get Record Count From plain/txt file

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/1381057331/m/3797038906

September 16, 2011, 05:11 PM
DBremer
Get Record Count From plain/txt file
Using the Execution Object: File Object to read in a text file.

Is there a way to determine how many records (rows) that the file read in has?

Use Case: If a bad validation file is created and it only contains a header, then No Email with attached document is needed. So if the file has more records other then the header record, then send the Email.

Has anyone figured out a way to do this?


iWay Service Manager (6.0.1 )
September 19, 2011, 04:44 AM
AdeH
Hi,
Certainly the File Listener creates an SREG called msgsize, not sure if the file object does the same. It may be worth putting an XDQAAgent object directly after the file read, and seeing if any other SREGs appear.

Regards,
Ade.


iWay 5.5 SMSP1 and 6.0.1 on Intel/Linux
September 19, 2011, 10:32 AM
Igor Y
After you read the file with the file read agent, it becomes a document. Try _length(_trim(_flatOf())) and compare it to the expected header size.


iWay Service Manager (6.0.1 - patch.62627)
DMC Version 7 Release 7
September 19, 2011, 11:52 AM
DBremer
I am going with the _length(_trim(_flatOf())) solution because low overhead of adding just a user properties and checking that value.

I appreciate both of you taking the time to provide a solution.


iWay Service Manager (6.0.1 )
September 21, 2011, 01:00 AM
Linda Gordon
I used _length(_trim(_flatOf())) because I found it working for the problem I had.It was a perfect solution to my problem.


Tim Manning New Zealand
September 22, 2011, 09:20 AM
Gopal_mys
Hi,

I guess you know the length of header section(consider it as 500).

COND(_LENGTH(_FLATOF()),GT,500).

Use the above in a decision check object and send the mail on the case of true or false accordingly.


iWay ISM 5.5/iWay ISM 6.0 on Windows.