update_script
Update an inSCADA script by replacing its code with a new Nashorn ES5 compliant script. Requires script ID and code, and prior reading with get_script.
Instructions
Update script code. Read with get_script first. Call inscada_guide for full script rules and ins.* API reference.
CRITICAL RULES (always apply):
Nashorn ECMAScript 5 ONLY. DO NOT USE: let, const, =>, template literals, destructuring, async/await, class.
STRUCTURE: function main() { /* code */ } main();
Historical date: dttm is ISO string, NOT epoch. new Date(isoString) returns NaN in Nashorn. Use: ("" + items[i].dttm).substring(11, 19)
Logged data is reverse-ordered (newest first) → use reverse loop for charts.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| script_id | Yes | Script ID (required) | |
| code | Yes | New script code (full code). Nashorn ES5: function main(){...} main(); structure required. |