Forum Discussion
If this is a valid copybook file, we have a COBOL Copybook parser that would do this with one snap, Ref: https://docs-snaplogic.atlassian.net/wiki/spaces/SD/pages/2386591995/Copybook+Snap+Pack.
Other snaps of interest would be the transcoder and fixed width parser snaps
Hi rdill,
We don't have the copybook parser snap.so that's why I am trying to read this cobol file using this python script and passing the output as Json.
Sp could you please help me how to execute this python script in script snap
nickhumble - could you simply enable the "Null-safe access" option and always reference the values you're looking for? If it doesn't exist, it will just be a null value. This would bypass the need for the get() method, which as you have found out, can't be used under multiple levels of object nesting.
- nickhumble2 years agoNew Contributor II
Thanks koryknick - this might just be the simplistic genius i was looking for!
If that doesn't work for you, then try this:
$.get('/position/field_2354910', {}).get('value')
Since the Object.get() method allows you to provide a default if the field doesn't exist, this example returns an empty object, so calling the next get() on the empty object will also return null.
Hope this helps!
- nickhumble2 years agoNew Contributor II
Thanks - my problem was i couldn't get a non-null value using .get, no matter what i tried. I wondered whether the forward slashes were confusing it or something, but .hasPath worked ok so i'm a bit stumped.
Your earlier suggestion has worked well though - thank you.
Related Content
- 2 years ago
- 3 years ago
- 2 years ago