- Posts: 13
Produce 2 output rows from 1 input row
- Heinz
- Topic Author
- Offline
- User
-
Less
More
11 years 6 months ago #2283
by Heinz
Produce 2 output rows from 1 input row - Post(2283) was created by Heinz
I would like to re-process a input row to produce a second putput row (obviously in the same output format) but using different fields / calculations based on the same input row.
Illustrative example
Input file contains 6 fields
INPUTROW1: F1,F2,F3,F4,F5,F6
Output file contains 3 generic fields and we extract infp from the record into output row 1:
OUTPUTROW1: TRXTYPE-A,F1,F2
I would now want to generate additional output rows:
OUTPUTROW2: TRXTYPE-B,F3,F4
And maybe even a 3rd - and thus n-th?
OUTPUTROW3: TRXTYPE-C,SomeConstantValue,F2+F6
And now we move on to next input row and continue the process.
I would thus need to be able to define "TRXTYPE" column based on which "additional" row I am generating and it can not be assumed I can use anything in the input row - it would need to be a "constant / X-Value PER additional output row"
Hope this makes sense?
Illustrative example
Input file contains 6 fields
INPUTROW1: F1,F2,F3,F4,F5,F6
Output file contains 3 generic fields and we extract infp from the record into output row 1:
OUTPUTROW1: TRXTYPE-A,F1,F2
I would now want to generate additional output rows:
OUTPUTROW2: TRXTYPE-B,F3,F4
And maybe even a 3rd - and thus n-th?
OUTPUTROW3: TRXTYPE-C,SomeConstantValue,F2+F6
And now we move on to next input row and continue the process.
I would thus need to be able to define "TRXTYPE" column based on which "additional" row I am generating and it can not be assumed I can use anything in the input row - it would need to be a "constant / X-Value PER additional output row"
Hope this makes sense?
Please Log in or Create an account to join the conversation.
- FlowHeater-Team
-
- Offline
- Admin
-
11 years 6 months ago #2284
by FlowHeater-Team
Best wishes
Robert Stark
Replied by FlowHeater-Team on topic Re:Produce 2 output rows from 1 input row - Post(2284)
Hi Heinz,
It's possible but it could be a hard work. The more columns you need the more complicated become.
I try to explain. You need the GroupOut Heater to copy one input row to X output rows. Then you need a static value to decide how many rows you are need. In the example I used 2 additional rows = 3 output rows!
Then you need for each row a condition (IF-THEN-ELSE Heater) to decide which content you would like to overtake.
For example) The first input column should be taken into the second output row and use the second column.
For this you need the AutoID Heater with activated "GroupOut" option. With this you can count the current copy of the row. This is needed for the condition. Last but not least you need before each row one String Append Heater to add more conditions to one field.
I think it shoud be clear after a look to the example, please have a look to the attachment.
Note: I used for each field one separate layer!
It's possible but it could be a hard work. The more columns you need the more complicated become.
I try to explain. You need the GroupOut Heater to copy one input row to X output rows. Then you need a static value to decide how many rows you are need. In the example I used 2 additional rows = 3 output rows!
Then you need for each row a condition (IF-THEN-ELSE Heater) to decide which content you would like to overtake.
For example) The first input column should be taken into the second output row and use the second column.
For this you need the AutoID Heater with activated "GroupOut" option. With this you can count the current copy of the row. This is needed for the condition. Last but not least you need before each row one String Append Heater to add more conditions to one field.
I think it shoud be clear after a look to the example, please have a look to the attachment.
Note: I used for each field one separate layer!
Attachment duplicate_csv_records.zip not found
Best wishes
Robert Stark
Attachments:
Please Log in or Create an account to join the conversation.
Time to create page: 0.256 seconds