Skip to main content

Code Block

1. Node Functionality

Process input fields using JS or Python, and output results, allowing for more personalized data processing effects.

2. Scenario Example

For instance, to determine whether a vehicle's license plate is restricted based on the current time and the license plate number. The restriction rules are as follows: From Monday to Wednesday, from 8 am to 10 am, vehicles with even-numbered license plates are not allowed to drive.

3. Configuration Steps

  1. Set worksheet fields: two text fields for license plate number and whether it is allowed to travel.
  2. Process Management — Create New Workflow — Worksheet Event Trigger
  3. Configure the trigger node to select the set worksheet
  4. Add a code block node, choose JavaScript or Python; here we select Python. Define the input object license_plate_number as the license plate number field. Enter Python code in the code block to determine the rules for whether the license plate number and the current time are restricted.
  5. After entering the code, click test to obtain the output result, and define the parameter type as text. After ensuring the output is correct, click save.
  6. Then add an update data node, updating the record's — whether it can travel field with the content outputted by the code block, selecting the parameter returned by the code block as the update value.
  7. After configuration, publish the workflow, and return to the worksheet page to add new data.

4. Effect