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: Grouping and Summing with If Condition

Grouping and Summing with If Condition 6 years 2 weeks ago #2071

  • Gennaro
  • Gennaro's Avatar
  • Offline
  • Junior Member
  • Posts: 25
Hi, I need to group only some records of an Excel input file, and only if some conditions are met.
I've tried using the group by and "if" functions but with no luck, please see below for an example, any suggestion would be very well accepted. thankx in advance.

Attachment Eample.zip not found

Attachments:
The administrator has disabled public write access.

Re:Grouping and Summing with If Condition 6 years 2 weeks ago #2072

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

That's a really nice challenge :) Yes, FlowHeater can handle it, but it’s a bit tricky. I have made an example to demonstrate this. Please have a look to the attachment "grouping_and_summing_with_condition.zip"

In the example I'm used the TextFile Adapter for READ (import.csv) and WRITE (output.csv). You can it simple to port to use it with the Excel Adapter. The TextFile Adapter is just a bit faster.

The example used How it's works:
First the If-Then-Else Heater checks the field "type" with the criteria "in". If the value match (=in) the string append heater appended the fields “code” and "type" and pass it to the GroupBy Heater. If the criteria don’t match the AutoID Heater generates a new number (+1) and passes it to the GroupBy Heater. The GroupBy Heater only grouping rows together if the same consecutive equally value are passed! In the else case there are never the same value because the AutoID Heater, that’s the trick. The Additions Heater just summing the incoming values by the group.

Attachment grouping_and_summing_with_condition.zip not found

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