Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Can I use JavaScript control flow inside my JavascriptProcessor scripts?

CONTROL flow Javascript scripts
0
Posted

Can I use JavaScript control flow inside my JavascriptProcessor scripts?

0

Yes. You write JavaScript in the normal way, and operate on the oa_data passed in which also doubles as the result object. Your condition expressions will typically involve data extracted from each incoming record. It can also involve variables from a separate properties file or command line which are specific to this executing instance of the adaptor: these are evaluated when the adaptor is loaded and thereafter behave as literal string values. As a design guideline we very strongly advocate avoiding writing long pieces of JavaScript (a screenful is long). Instead break down your JavaScript into small blocks of defined functionality and place each in a separate ScriptProcessor. This makes it much easier to unit-test each piece of logic (we plan to provide some practical help with this at the component level in the future) according to expected inputs and outputs. It also allows you to take advantage of the discard and exception routing support of OpenAdaptor. Note that hosting it in m

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123