Code Appendix
Worked code snippets for the places in Informer where you can write a little JavaScript: calculated and script Fields, Power Script Flow Steps, and Web Query response parsers. Use them as starting points and adapt the field names to your data.
Where code runs in Informer
| Context | What you write | Key variables |
|---|---|---|
| Calculated / script Fields | A JavaScript expression that produces a Field's value, one row at a time. | $record['alias'] for the current row's Fields; moment() for dates. |
| Power Script Flow Steps | JavaScript that runs once per record as part of a Query's flow. | $record for the current row; $local to carry values across rows. |
| Web Query response parsers | JavaScript that turns a web service's response into records. | response for the payload; push() to emit rows; next() to fetch another page. |
The script sandbox exposes a consistent set of globals, including $record (the current row), $local (a place to keep state across rows), $field/$inputs, and saved functions, so the same patterns carry from one context to the next.
A quick example
Formatting a date Field with Moment.js in a calculated Field:
var date = $record['fieldAliasGoesHere'];
var formattedDate = moment(date).format('MM-DD-YYYY');
formattedDate;
In this section
| Article | In one line |
|---|---|
| Aggregating across rows with Power Scripts | Use $local and a Flush Flow Step to total a Field across a result set. |
More snippets are being curated from the imported appendix: array and string manipulation, more date helpers, and Web Query response parsers (pagination, token retrieval, and custom parsing).