cancel
Showing results for 
Search instead for 
Did you mean: 

Merging output of one document in next

krupalibshah
Contributor

I am working on a pipeline where I am reading data from CSV generator.

I have 2 types of data H line and I line for each one I need to do some mapping, which is fine. the final output I need to sent to SAP with a format H + I

So I need to merge the H line to each I line and then post to SAP.
Can someone help me achieve this? As all the values are in an independent document I am not able to do it easily. I tried Join and Union followed bu Group by but still not getting desired result.

image

image

image

Desired result:

image

/KS

10 REPLIES 10

tlui
Former Employee

Is there a key that you can use to join the data? If not could you add an artificial key and then join the two documents?

image

I tried using merge operation to add sequence but I get the error,

Snap has the following errors. Please open the info box and edit the highlighted fields.
Failure: Invalid JSON-path: $group[*].DOCUMENTHEADER, Reason: Field not found in JSON object: DOCUMENTHEADER, Resolution: Check the path syntax

image

I tried to use join operation, the output is

image

How to merge the documents?

nganapathiraju
Former Employee

Do H and I refer to Header and Line data?

Do you only have one H and multiple I lines?

If so, copy the incoming stream and process them independently and merge join them after you are done processing.

Hope it makes sense.

Let us know if this is not what is expected.

Thanks for the input.

Yes H and I are for header and line items.
I have done similar thing where I am routing H and I to different mapper and processing them individually. Once done I did a merge join and getting one H+I and I in 2 documents. I want H+I+I in one document.

/KS