Skip to main content
simply more productive

The Data Specialist

Thanks to our intuitive transformation designer, you can convert data effortlessly to a variety of formats without knowing how to program. It’s not only efficient, it’s also easy to use.
Flowheater Download

Preventing empty lines in a text file export

  • FlowHeater-Team
  • Topic Author
  • Offline
  • Admin
  • Admin
More
12 years 10 months ago #2114 by FlowHeater-Team
Preventing empty lines in a text file export was created by FlowHeater-Team
Translated submission in the German forum. You can read the original entry here .

Hi everybody,

Maybe I'm trying to run before I can walk...

I receive a CSV export file with ';' separators and of 100 lines. The export file is always 100 lines long, even if only 20 of the lines contain data.

I've attempted using the If-Then and Filter functions, with a >0 condition to eliminate the empty lines, so that I don’t end up with 80 empty lines of ';;;;;;;'. The Filter shows a counter field, prior to which a 'Trim Start' is inserted, so that any leading white space characters are eliminated.

Am I trying to do this the wrong way?

Roland

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.

Please Log in to join the conversation.

  • FlowHeater-Team
  • Topic Author
  • Offline
  • Admin
  • Admin
More
12 years 10 months ago #2115 by FlowHeater-Team
Replied by FlowHeater-Team on topic Re:Preventing empty lines in a text file export
Hello Roland,

In addition drag a String Append Heater onto the Designer window and connect to the input of the Heater all the CSV fields on the READ side that could possibly be empty. Then pass the output through a Trim Heater . The result of this you can now easily test with a IF-Then-Else condition comparing it with an empty string (see note further below), this supplies the correct input for the boolean (=TRUE) required by the Filter Heater .

If all the CSV fields are empty or contain white space, the String Append Heater concatenates a string of only white space. The Trim Heater eliminates all the white space at the beginning and end of a string. If there was only white space in the concatenated string, the string length now becomes 0. The string length is tested for zero in the If-Then-Else Heater and in this case returns TRUE. The Filter Heater then ignores the empty row, leaving only rows with actual data in the CSV export.

Tip: In order to directly compare with an empty string (a string of length 0), you only need to enter the single character "=" in the If-Then-Else Heater condition and click the Insert button. You do not need to enter an actual value. Alternatively, you could pass the result through a String Length Heater and enter "=0" in the If-Then-Else Heater condition.

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.

Please Log in to join the conversation.

Time to create page: 0.334 seconds

FlowHeater - The Data Specialist

Efficient data integration and transformation with FlowHeater – the perfect solution for a seamless transfer of your data.

Rechtliches

Support & Contact

Kontaktinformation

Telefon:0951 / 99339792 E-Mail:This email address is being protected from spambots. You need JavaScript enabled to view it.

Copyright © 2009-2024 by FlowHeater GmbH. All rights reserved.