I think I now understand the question. I put together a dataflow to solve it, and since it can't be attached, I'll describe what I did.
- Create Data - your input data.
- Add a Record Index - We need a way of identifying a record id. When looking at the data I made a guess that each time we see a _DataTimeStamp key value, we are on a new record.
- Pivot - Data to Names - This produces the output and is easy once we have the record id.
Add a Record Index:
ConfigureFields:
out1 += in1
out1.RecordIndex = long
recordIndex = 0
# We need a record index so we know what record each field belongs to.
ProcessRecords:
out1 += in1
# Every time we see a _DateTimeStamp field, assume we are starting a new record
if in1.Key == "_DateTimeStamp":
recordIndex += 1
out1.RecordIndex = recordIndex
Pivot - Data to Names
Note that under Optional it was necessary to set NameSet to Union because not all of the output records have all of the field names supplied.
------------------------------
Ernest Jones
Precisely Software Inc.
PEARL RIVER NY
------------------------------
Original Message:
Sent: 01-19-2023 14:44
From: Tevita Fainga
Subject: Data Transformation
Input source
------------------------------
Tevita Fainga
Tonga Communications Corporation
Fasi-moe-Afi
Original Message:
Sent: 01-19-2023 11:44
From: Ernest Jones
Subject: Data Transformation
I'm not sure what the input to your node is. but could you just add this line to the Script?
emit 'FileSourceName'
Ernest
------------------------------
Ernest Jones
Precisely Software Inc.
PEARL RIVER NY
Original Message:
Sent: 01-18-2023 21:05
From: Tevita Fainga
Subject: Data Transformation
I have come across this problem with the data that I'm working with. The data transformation was raised on separate post previously and it was successfully transformed but it was excluded one important element of the data is the SourceFileName to also appended on every set of data just like how it shows on the attached excel file.
Note:
1 source file - contains approx. 100K+ lines of data
Total Files - contains approx. 50 mil + lines of data
------------------------------
Tevita Fainga
Tonga Communications Corporation
Fasi-moe-Afi
------------------------------