Forum Discussion
@marenas - Unless you are running the File Poller snap in an Ultra Task which will automatically restart the task as soon as it closes, I would recommend that you schedule the task for the minimum acceptable “downtime” in the event the File Poller terminates abnormally. As of the 4.26 release (Sep '21), SnapLogic enabled the Snaplex-based Scheduler, which means that scheduled task timing and reliability is dependent on your local snaplex and should be very close to the selected timing.
With that stated, you could set your File Poller to check for file existence as often as you wish, with the timeout set for 59 minutes (for example), then create the Scheduled Task to execute every 5 minutes with the “Do not start a new execution if one is already active” option enabled. This means that the polling would only be “down” at most 5 minutes every hour. Since the scheduler is using local snaplex resources, you could even have the task scheduled every minute if you desire.
Thank you so much. It worked by creating an empty $array[*].subArray. Do you know where I can learn more about the syntax to use to manipulate JSON like this? I get stuck and spin my wheels a lot on these types of issues.
Also, is there a way to delete just a simple field, not an array/list, with the Mapper if its null like the above expression did for the array? When the right Target path is empty, I’m not sure what expression to use on the left to return the field when its null.
We have our own documentation for JSON-Path. There are also online testers, like:
Note that most JSON-Path implementations are only for reading data, whereas we use it for updating and deletions. So,
In the Designer, you should be able to drill down into the document structure in the Mapper and in the drop-down for expression properties.
It’s pretty much the same thing, except instead of checking for
value.field1 == null
you can check ifvalue == null
. So, you would write a path to the object whose fields you want to delete (e.g.$.foo.bar
) and then use the filter operator ([?(... expr ...)]
) to select the fields to delete:$.foo.bar[?(value == null)]
If I have the following in a JSON Generator and a subsequent Mapper, what do I put in the Expression to remove “id” field if its null? I’m getting a parsing error when trying $.id[?(value == null)].
[
{
“id”: 21,
“eId”: [
256,
2,
548,
14010
]
},
{
“id”: null,
“eId”: [
256,
2,
548,
14010
]
}
]