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

Parameters are not being recognized in output stream of UNION snap

SGArchitect
New Contributor II

I am using UNION snap to get input streams from 2 snaps. Next to the UNION snap, I have a MAPPER snap that tries to access the output stream of UNION snap.
Please see attached screenshot.

I can see the parameter $response.entity.token but snap keeps erroring saying that there is no such $response parameter. Could you please guide me on this? I have already spent 6 hours trying to debug this issue.

image

image

3 REPLIES 3

SpiroTaleski
Valued Contributor

@SGArchitect

That is happening because the output of the Union Snap will produce multiple documents(from both inputs). And some of the documents does not contains the value that you are referring to, which throws an error.

By checking the โ€œnull safe acessโ€ in the mapper snap will prevent the error, and on the output of the mapper snap you will have the same number of documents as input. The documents that does not contains the path that you are referring will have โ€œnullโ€ value on output.

BR,
Spiro Taleski

SGArchitect
New Contributor II

Thank you, Spiro

alex_panganiban
Contributor

I think as an alternative to using the null safe access feature, you could also use the hasPath() and get() methods. I like using the get() a little more because if the path doesnโ€™t exist, then it will automatically assign a null to the result of the expression, whereas the hasPath() method renders a true or false result. If you use hasPath(), then youโ€™ll probably want to incorporate it as part of a ternary expression.

Hereโ€™s a few conceptual examples for you.

image