Skip to main content
Solved

count number of lines per file

  • May 8, 2019 1:20 PM UTC
  • 2 replies
  • 204 views

nedwaterman
Contributor
Forum|alt.badge.img+9

Hello,

I need to process a number of text files holding differing numbers of data rows.

The first 7 lines are fixed - they are the loggerid / siteid / channelref / units / totals / startdate / enddate.

After that there could be a different number of rows with a datetime and a value.

I need to process these files into a sql table with the fixed 7 lines data added to the datetime and value rows. The data in the first 7 lines will change so I need FME to process the files once at a time into the writer rather than all at once.

Any idea how I do this?

Cheers

N

Best answer by erik_jan

The transformers you want to use for storing the first 7 rows of information are VariableSetter and VariableRetriever.

Hope this helps.

 

View original
This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

2 replies

erik_jan
Contributor
Forum|alt.badge.img+26
  • Contributor
  • Best Answer
  • May 8, 2019 2:07 PM UTC

The transformers you want to use for storing the first 7 rows of information are VariableSetter and VariableRetriever.

Hope this helps.

 


nedwaterman
Contributor
Forum|alt.badge.img+9
  • Author
  • Contributor
  • May 9, 2019 6:43 AM UTC

Hi erik_jan,

 

Thanks for your reply. I'm successfully using both those transformers but are having issues reading the data below the 7 fixed lines. I'm trying to use a Modulo counter to add line numbers to the input file, but that transformer requires an end count of rows, and I'm not sure how to calculate this. I thought a text-line count might do it, but it's not working.

 

Any ideas would be gratefully received!

 

Thanks

N