โ09-08-2021 10:45 AM
We built a custom snap that performs a transformation. You will notice in the output of the custom snap in the screenshot below that โmedicalEnrollmentโ is a json array.
In a downstream mapper, we attempted a transformation on this array. We have tried (1) using the sl.ensureArray() method and (2) another downstream mapper performing a transformation in the array. However, we notice that in both the #1 and #2 attempts the mappers do not detect the array, thus causing issues with the transformation.
Below is a snippet of the preview of what we expect vs actual preview.
We also notice that chaining a Json Formatter and a Json Parser right after the custom snap does indeed makes the mappers work correctly. Pattern shown below:
So my question is, is there something hidden in the JSON parser snap that allows strong typing of the array that we are missing? Anything in between?
@robin , Tagging you since I was told you might be able to help out. Thanks!
Solved! Go to Solution.
โ09-09-2021 03:47 PM
Thanks. I installed the binary snap pack and set a breakpoint in the Mapper to see the Java types used in the input, which is the output of your snap. I can see that medicalEnrollment is still a HashSet, not an ArrayList:
I havenโt studied your source code but I can see that youโre still using HashSet in a lot of places. Donโt use that type anywhere in your Document data. Itโs not compatible with any of the JSON types. Use ArrayList everywhere you need an array.
โ09-09-2021 10:33 AM
Iโve looked at the ticket and can see thereโs a pipeline link. Can you please provide me with the permission to execute that pipeline? My username is ptaylor@snaplogic.com.
โ09-09-2021 10:44 AM
I see two different versions of the same custom snap pack in your /shared directory. They both appear to implement the same set of three snaps, including โExcel Structureโ. One of them was updated today, but the other was last updated two days ago. Iโm wondering if the pipeline youโre testing might be using the older one rather than the one you just updated to output an ArrayList. I suggest removing the older one to ensure itโs no longer being used if thatโs your intention.
โ09-09-2021 11:05 AM
@ptaylor , I have granted you access to the org and created a copy for you. Our newest snap is com-snapit-excelstructure_1-0001 and thatโs the one thatโs being used at the moment.
โ09-09-2021 11:27 AM
Thanks, but where can I find the copy I can access?
โ09-09-2021 11:41 AM
@ptaylor Our organization is MercerDigitalDev. The pipeline is located in Workbook v3 - Projects/0000 - Snaplogic Testing. Either of the pipelines in that folder would work.