Dynamic data import / export

datenbank

simply more productive
Up to 10,000 records can be processed with the freeware version!
Welcome, Guest
Username: Password: Remember me
Welcome to the FlowHeater support forum.

Questions about using FlowHeater are answered here.

TOPIC: Row count

Row count 4 years 2 months ago #2246

  • Gennaro
  • Gennaro's Avatar
  • Offline
  • Junior Member
  • Posts: 25
Hi!
i was wandering if is it possible:

- to count the total number of rows of a text file on the read side
and then
- to use the result (total number) as output to a filed on the write side

any suggestions?

thanks in advance
The administrator has disabled public write access.

Re:Row count 4 years 2 months ago #2247

  • FlowHeater-Team
  • FlowHeater-Team's Avatar
  • Offline
  • Administrator
  • Posts: 240
Hi Genaro,

Yes, it is! If you want to add the line count to each row you have to use the power of the .NET Heater and the following little script. In the attachment you’ll find an example.
int rows = -1;

public object DoWork()
{
  // only read the input file one time
  if (rows < 0)
  {
    // Getting the READ Adapter
    TextFileAdapter adapter = (TextFileAdapter)AdapterRead;

    // Read all lines
    string [] lines = File.ReadAllLines(adapter.Filename);

    // adopt the line count
    rows = lines.Length;
  }

  return rows;
}

If you want to add the line count to a Header/Footer row you can find an example here. Processing of CSV header and footer rows

Attachment counting_rows.zip not found

Attachments:
Best wishes
Robert Stark

Did this answer your question? We would be grateful if you provide a brief comment as feedback. It may also help others who may have encountered a similar problem.
The administrator has disabled public write access.
Moderators: FlowHeater-Team
Time to create page: 0.073 seconds