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: Removal of unprintable characters

Removal of unprintable characters 5 years 11 months ago #2075

  • FlowHeater-Team
  • FlowHeater-Team's Avatar
  • Offline
  • Administrator
  • Posts: 240
Translated submission in the German forum. You can read the original entry here.

Hi,

I regularly import Excel files which contain characters that cannot be printed. Is there some way to eliminate these with FlowHeater during an import? There is a "clean up" function in Excel, but due to the large number of rows, the use of this function is not practical for me.

Best regards,
Achim Federle
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.

Re:Removal of unprintable characters 5 years 11 months ago #2076

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

You can achieve this using the .NET Script Heater along with the script I have written below.

You have to drag a .NET Script Heater on the Designer window for each individual Excel field that could possibly contain unprintable characters. Then copy the script below into the Heater configuration and connect the incoming field to the .NET Script Heater as well as its output to the relevant field on the WRITE side.
This script filters the characters of the incoming string. I think it should work for the most frequently used characters.
public object DoWork()
{
	object invalue = InValues[0].GetValue();
	if (invalue == null)
		return invalue;

	string replace_with = "";  // = remove from string
	// string replace_with = " ";  // = replace with space

	// add additional characters here
     string special_character= "\t\n\r\\[\\]!ß´#\"$§%&' ()*+€,-./:;<=>?@\\^_`{|}~";

     Regex myRegex = new Regex(@"[^\w\d" + special_character + "]");
     return myRegex.Replace((string)invalue, replace_with);
}

At present it passes through:
- all letters and numbers
- most special characters (see comments in the script)

If some special characters are eliminated that should not be replaced/removed, you just need to add those characters to the list of special characters in the script, between the quote marks (see the comments in the script).

Note: This script makes use of regular expressions (Regex) and hence is only supported by FlowHeater versions 1.2.6 and above. For further information about this, please refer to the ReleaseNotes.
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.071 seconds