cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Get current JSON document being inserted

Mark
New Contributor II

I have a pipeline with a oracle insert snap and a error pipeline. Everything works. When something in the pipeline fails I am passing variables to the error pipeline and storing in a table. I want to pass the current JSON document that failed? What variable do I use to get the current JSON document that failed without having to concatenate all the values into a string myself? I want to pass the json document that failed to insert actually? I know its $.something but what?

1 ACCEPTED SOLUTION

Mark
New Contributor II

I had to do this JSON.stringify($original), but that worked. Using $original caused insertion problems into a varchar2 or clob because it wasnt the same datatype. But, your recommendation to put it in the mapper snap of the error pipeline worked out great because I only had to change the one error pipeline and not all 20 or so pipelines that call the error pipeline. Thanks

View solution in original post

5 REPLIES 5

SpiroTaleski
Valued Contributor

@Mark

You can find the data that failed under the original object.

ex: $original

Regards
Spiro Taleski

Mark
New Contributor II

I put $original as the expression populating a error pipeline parameter in the pipeline properties of the pipeline. When I run the pipeline the pipeline complains โ€œReason: Value referenced in the sub-expression โ€˜$originalโ€™ is nullโ€. ?

SpiroTaleski
Valued Contributor

@Mark

That will not work.

The main pipeline will propagate the error message(containing the error details along with original data) to the linked error pipeline.

In the error pipeline using Mapper Snap you can access all the fields from the error message.

Add Mapper Snap at error pipeline level and try to access the $original object.

If that will not work, please share the sample pipelines.

Regards,
Spiro Taleski

Mark
New Contributor II

I have a mapper in the erorr pipeline. Let me try that.