LoopCalc

Calculation Within the Loop

Security Level 1 (Enabled)
SindByte tool execution flow: voice command, AI parse, execute, validate, result

Description

Performs complex calculations using the current variables of a running loop. Combines LoopStep with formula evaluation for maximum flexibility in iterative calculations.

JSON Parameters

{
  "loopId": "calc_001",
  "calculations": [
    {
      "target": "result",
      "formula": "sum / count",
      "condition": "count > 0"
    }
  ]
}
ParameterTypeRequiredDescription
loopIdStringYesThe loop identifier
calculationsArrayYesList of calculations to perform
calculations[].targetStringYesTarget variable for the result
calculations[].formulaStringYesFormula to calculate
calculations[].conditionStringNoCondition for the calculation

Example Usage

API call:

POST /api/v1/tools/loopcalc
Content-Type: application/json

{
  "loopId": "avg_calc",
  "calculations": [
    {
      "target": "average",
      "formula": "sum / count",
      "condition": "count > 0"
    }
  ]
}

Examples

Calculate the mean:

{
  "loopId": "avg_calc",
  "calculations": [
    {
      "target": "average",
      "formula": "sum / count",
      "condition": "count > 0"
    }
  ]
}

Standard deviation:

{
  "loopId": "stats_loop",
  "calculations": [
    {
      "target": "mean",
      "formula": "sumX / count"
    },
    {
      "target": "variance",
      "formula": "(sumX2 / count) - (mean^2)"
    },
    {
      "target": "stdDev",
      "formula": "sqrt(variance)"
    }
  ]
}

Percentage calculation:

{
  "loopId": "progress_loop",
  "calculations": [
    {
      "target": "percentage",
      "formula": "(current / total) * 100"
    },
    {
      "target": "remaining",
      "formula": "total - current"
    }
  ]
}

Return Values

{
  "loopId": "calc_001",
  "results": {
    "result": 15.5
  },
  "variables": {
    "sum": 155,
    "count": 10,
    "result": 15.5
  },
  "success": true
}
FieldTypeDescription
loopIdStringThe loop identifier
resultsObjectCalculated results
variablesObjectAll current variables
successBooleanTrue if successful

Related Tools

Why This Tool Stands Out

Perfect for:

Time Savings

No measured time-saving or performance figures are available here. Results depend on the task and environment.

Ready to Get Started?

Automate your iterative calculations with LoopCalc.

Download Now
Back to MathTools