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.
Up to 100,000 records can be processed with the freeware version!
Flowheater Chart

How to handle fields that contain multiple values

  • FlowHeater-Team
  • avatar Topic Author
  • Offline
  • Admin
  • Admin
More
3 days 13 hours ago #3836 by FlowHeater-Team
How to handle fields that contain multiple values was created by FlowHeater-Team
Hi

I am trying to take some geographic data and load it into a MS-SQL Server table.

The problem is several fields contain multiple values, and the number of them is variable from 1 to N. They are separated by commas.
I want to convert to normal relational form, so each incoming record must create a variable number of output records.

For example:
Lake A; (Town B, Town C, Town D , Town E);

The lake is shared between 4 towns. It may be divided between 1 up to an unknown maximum number of towns.

I want to end up with the following:
Lake A, Town B
Lake A, Town C
Lake A, Town D
Lake A, Town E
...

I can’t seem to figure out how to do this with Flowheater.

Are there any examples on your website?

Kind regards
Mike
Request reveived via E-Mail
 

Best wishes
Robert Stark

Please Log in or Create an account to join the conversation.

  • FlowHeater-Team
  • avatar Topic Author
  • Offline
  • Admin
  • Admin
More
3 days 13 hours ago #3837 by FlowHeater-Team
Replied by FlowHeater-Team on topic How to handle fields that contain multiple values
Hi Mike,

You can handle this with the help of the GroupOut Heater and the little C# Script (see below) into the .NET Script Heater .

The GroupOut Heater makes just N copies of the incoming row. To figure out how many copies you need you have to count the delimiter sign in the “Towns” column with the Occur Heater .

Now you need the index of the current copied row. For this you need the AutoID Heater with enabled “GroupOut” option. With this the AutoID Heater counts from 1 to the copied row.

The .NET Script takes this row index, splits the “Towns” column by the comma sign and returns the right part.

I´ve made a brief example, see attached ZIP file.

Screenshot description
  1. Remove the start and ending brackets with 2 String Replace Heater
  2. Count the comma sign with the Occur Heater
  3. Copy the input rows
  4. Get the current copied row index
  5.  Execute the script and retrieve the right Town part
  6. Remove white space signs

C# Script
Code:
public object DoWork() {     // get current column index from AutoID Heater = first input value     int i = (int)InValues[0].GetInt();     // get values = second input value     string values = (string)InValues[1].GetString();     // Split into parts by comma delimiter      string [] parts = values.Split(',');              // return current part. Note: zero based index!     return parts[i]; }

 

 
File Attachment: File Name: copy-input-recods.zip
File Size:9 KB

 

Best wishes
Robert Stark

Please Log in or Create an account to join the conversation.

More
3 days 5 hours ago #3838 by Michael Orr
Replied by Michael Orr on topic How to handle fields that contain multiple values
Thanks for the very prompt response.

Please Log in or Create an account to join the conversation.

Time to create page: 0.291 seconds
FlowHeater Logo

FlowHeater - The Data Specialist

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

Legal information

Support & Contact

Contact

Phone:
0951 / 9933 9792

eMail:
info@flowheater.net


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