Skip to main content
Solved

count number of lines per file


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
Did this help you find an answer to your question?

2 replies

erik_jan
Contributor
Forum|alt.badge.img+17
  • Contributor
  • Best Answer
  • May 8, 2019

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

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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings