Apply Mathematical Operations in Scripting

Modified on Fri, 05 Jan 2024 at 10:30 AM

Based on the LabOperator Schema with scripting format in YAML and supported script types, here is an example of how to apply mathematical operations on strings:


---
schema_version: '1.0.1'
info:
  version: '0.0.2'
  uuid: c9c6ef76-5983-443a-a020-bc366a142f11
  title: Mathematical Operations


fields:
  testScriptField:
    type: script
    script: |
      (1 + 2) / 2
    result:
      type: number
    hidden: true


steps:
  stepOne:
    info:
      title: Test
   
    substeps:
      - primary: Test
        expandDescription: true
        description: |
          This is a test YAML file:


          {{testScriptField}}
     
flow:
  - stepOne


When it is uploaded to LabOperator, the Workflow Run works successfully. The ‘testScriptField’ holds the result value of the mathematical operation: (1 + 2) / 2





Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article