SCRIPT EDITOR GUIDE · DEVELOPMENT V41.8

Variables, JSON & expressions

Learn to save values, reuse API data, combine text, calculate numbers and create conditions without writing Python.

1. Ways to set a variable

In Script Editor, add set_variable. Put the output variable name in Target and the content in Value. Expressions must begin with =.

PurposeTargetValue
Plain textnamePBX TECH
Copy another variablecopy${name}
Numeric valuecount= 100
Text with a prefixlabel= "name: " + ${name}
Merge two variablesfull_name= ${first} + " " + ${last}
Math resulttotal= ${price} * ${quantity}
Boolean comparisoneligible= ${total} >= 500

2. Nested JSON objects and arrays

Suppose server_response contains this parsed JSON object (or a JSON string):

{"link":"https://example.com","user":{"name":"PBX"},"items":[{"id":101},{"id":102}]}
ReferenceResult
${server_response.link}https://example.com
${server_response.user.name}PBX
${server_response.items.0.id}101
${server_response.items.1.id}102

Write a complete reference such as ${server_response.items} to preserve the JSON list when assigning it directly. References inside ordinary text are converted to display strings. You can still use json_get for explicit path extraction.

3. The calculate action

Add calculate under Script & Data. Target is the output variable, and Value is an expression beginning with =.

Action: calculate
Target: total
Value: = ${unit_price} * ${quantity}

Action: calculate
Target: greeting
Value: = "Hello, " + ${customer_name}

4. Math and text conversion rules

ExpressionResultType
= 10 + 515Integer
= 10 - 55Integer
= 10 * 550Integer
= 10 / 25Integer (exact)
= 10 / 42.5Decimal
= 10 + "abc"10abcString
= "abc" + 10abc10String
= 10 - "abc"10 - abcString
= 10 * "abc"10 * abcString
= 10 / "abc"10 / abcString

When both operands are numbers, arithmetic remains numeric. When either operand is text, + joins strings; -, * and / produce readable strings rather than raising type errors. Numeric division by zero still produces an error.

5. Comparisons and conditions

Use these expressions in calculate, if, or else_if:

= ${amount} > 100
= ${amount} < 500
= ${status} == "completed"
= ${price} * ${quantity} >= 500
= ${amount} > 100 and ${quantity} < 10
= not (${status} == "failed")

Supported operators: +, -, *, /, >, <, >=, <=, ==, !=, and, or and not. Comparisons produce boolean values.

6. Complete example: API response to browser navigation

http_request
  Target: https://your-authorized-api.example/items/1
  Value: {"method":"GET","save_as":"server_response"}

set_variable
  Target: destination
  Value: ${server_response.link}

calculate
  Target: display_name
  Value: = "Destination: " + ${destination}

open_browser
  Target: ${destination}

Only open URLs you trust. Configure authentication and server access permissions separately.

7. Troubleshooting and limitations

Common mistakes: Writing "name: " + ${text} without the initial = stores ordinary text rather than evaluating the expression. Use quotes around literal strings inside expressions. Missing JSON keys or variables raise a clear error; numeric division by zero raises an error. Arbitrary Python functions, method calls and object mutation are not supported.

Existing exact-name variables such as ${record.email} are still compatible. Development V41.8 expression changes have passed local tests but require full Windows workflow verification. The public release label remains v1.0.0.