In any Synatic process, there may be a need for custom calculations and code. For example, the Calculator step in Synatic lets you add custom Javascript code to a Flow.

In this article, we will use the Calculator step and introduce a deliberate error and then see the Synatic response and how we resolve it.

The flow below shows a data source from an HTTP Service and then read in the JSON format. The next step is the Calculator step, which can execute some code on the data or execute a calculation.

To view errors during a flow test, let's force a "false" error into the calculator JavaScript code, as shown in lines 4 and 7 below.

  • Click the blue play ▶ button adjacent to the Calculator step.

    📝 This option lets you test up to the Calculator step on the flow.

    📝 The Break on Error option is selected by default,

  • This causes the run to process the dataset and stop immediately on the first error encountered.

    • Click on Object to expand the error details.

Now we'll deselect the Break on Error option and re-run the test,

  • Click the blue play ▶ button adjacent to the Calculator step.

    📝 This option will retest the flow up to the Calculator step.

  • The test will run the process through the dataset and collate all errors in the Error Records tab.

Because we deliberately inserted an error in the JavaScript code, you'll notice that record IDs 2 & 7 are missing from the list in the LOG tab.

  • 📝 An Error Records tab now also exists on the Debug Data results dialog which you can view in the Debug Data dialog.

When you go back to the flow, you'll see test statistics above the steps that were tested. For example, ten records were read and successfully processed in the JSON step, but in the Calculator step, only eight were successful, and two were in error.

You can click on the little bug icon to review the data output again.

You can now use all this information to trace the error back to its source.

Did this answer your question?