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

Write first grouping value to database

  • FlowHeater-Team
  • Topic Author
  • Offline
  • Admin
  • Admin
More
13 years 2 months ago - 4 months 2 weeks ago #2079 by FlowHeater-Team
Write first grouping value to database was created by FlowHeater-Team
Translated submission in the German forum. You can read the original entry here .

Hi,

Unfortunately we have a problem and I can’t find information about this on the website.
My input data has records sorted on the key column [DEVICE] Several instances of the same key can occur, and in this case an additional field defines the sequence [EXTRA].

Output to the database should be a single record containing a consolidation of the data.
We have grouped the data on the [DEVICE] column and thereby obtain a sum of the numeric column [COST].

In the output data, only the text in the [DESCRIPTION] column where the [EXTRA] column is empty should be passed on. This represents the heading information for the group, so to say.

We were not able to implement it ourselves.
Can you advise whether this is possible?

Example of actual INPUT data
Device;Extra;Description;Cost
10001;;Headline 1;1000
10001;E1;Extra 1;500
10001;E2;Extra 2;500
10002;;Headline 2;2000
10002;E1;Extra 1;500
10002;E2;Extra 2;500

Example of OUTPUT desired
Device;Description;Cost
10001;Headline 1;2,000.00 €
10002;Headline 2;3,000.00 €

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.
Last edit: 4 months 2 weeks ago by FlowHeater-Team.

Please Log in to join the conversation.

  • FlowHeater-Team
  • Topic Author
  • Offline
  • Admin
  • Admin
More
13 years 2 months ago #2080 by FlowHeater-Team
Replied by FlowHeater-Team on topic Re:Write first grouping value to database
Hi,

The problem with this is that with a grouping performed by the GroupBy Heater normally overwrites the string data for a group from each row in sequence and so any text in the final row of a group effectively determines the output. If you wish to retain the text data from an alternative row in the group instead, it is necessary to choose this with an IF-THEN-ELSE condition .

I have constructed a short example to process your data, see the attached grouping.zip.

Please note that the IF-THEN-ELSE Heater in this example only has 2 input parameters.

1x the value compared by the condition
1x the value that will be passed on if the condition is met

In this case the [EXTRA] column is compared with an empty string; in your case this is only true for the first row in each group, where the [EXTRA] column is always empty.

Only when the condition is met is the [DESCRIPTION] column written to the output field.
When the condition is not met, nothing is passed on by the IF-THEN-ELSE Heater, because only one output parameter is defined, hence the value in the first row of each group is not overwritten.

Attachment grouping.zip not found


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.
Attachments:

Please Log in to join the conversation.

Time to create page: 0.282 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.