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: Entries with no dates

Entries with no dates 3 years 4 days ago #2300

  • Richard Jupp
  • Richard Jupp's Avatar
  • Offline
  • New Member
  • Posts: 1
I have a csv file with a series of entries that are preceeded by a time date stamp on separate lines.

So something like this:

Time; Date; Data 1; Data2;
13/11/2013 10:26:35
2520,0 9354,7
9354,7 2520,0

When importing the data I wold like it to appear like this:

Time; Date; Data 1; Data2;
13/11/2013 10:26:35
13/11/2013 10:26:35 2520,0 9354,7
13/11/2013 10:26:35 9354,7 2520,0

Is this achievable with this software?

Thanks in advance for your help.

Regards

Richard
The administrator has disabled public write access.

Entries with no dates 3 years 2 days ago #2301

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

It’s possible but a bit tricky. For this you have to use the .NET Script Heater, the little script below and last but not least the Filter Heater, too filter out the Date/Time CSV rows.

public object DoWork()
{
  int count = InValues.Length;
  if (count != 1)
    throw new Exception("one input parameter expected!");
	
  string sIN = (string)InValues[0].GetString();
  if (sIN != null && sIN.Length >= 8)
  {
    // Check for date values
    if (sIN[2] == '/' && sIN[5] == '/')
    {
      // Set DATE / TIME parameter for further processing -> GetParameter Heater
      
      char [] split = { ' ' };
	string [] sDT = sIN.Split(split);
       
      // Set parameter DATE
      Parameter["DATE"].Value = sDT[0];

      // Set parameter TIME
      if (sDT.Length >= 2)
	  Parameter["TIME"].Value = sDT[1];
      else
        Parameter["TIME"].Value = "";

      return true; // Filter this row
    }
  }

  return false; // do not filter this row
}

Move a .NET Script Heater and a Filter Heater into the Designer. Connect the first CSV column with the input of the .NET Script Heater. The output you have to connect with the Filter Heater. Double click on the .NET Script Heater and insert the script above. That’s all :)

The script decides whether the CSV row is a DATE/TIME row. In case the CSV row contains a DATE/TIME row the script copy the DATE and TIME value into two FlowHeater Parameter with the same name and filter this CSV row out. On the WRITE side you could access to these Parameter values by using the Set/Get Parameter Heater.

You’ll find a little example in the attached file.

File Attachment:

File Name: csv-processing.zip
File Size:2 KB
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.074 seconds