LoopCalc
Calculation Within the Loop
Security Level 1 (Enabled)
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"
}
]
}
| Parameter | Type | Required | Description |
|---|---|---|---|
loopId | String | Yes | The loop identifier |
calculations | Array | Yes | List of calculations to perform |
calculations[].target | String | Yes | Target variable for the result |
calculations[].formula | String | Yes | Formula to calculate |
calculations[].condition | String | No | Condition 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
}
| Field | Type | Description |
|---|---|---|
loopId | String | The loop identifier |
results | Object | Calculated results |
variables | Object | All current variables |
success | Boolean | True if successful |
Related Tools
Why This Tool Stands Out
- Complex Formulas Conditional calculations with the full range of formulas - scientific precision!
- Conditional Execution Calculate only when needed - avoid division by zero, eliminate errors!
- Multiple Results One calculation, many results - complete statistics in a single step!
- Loop Integration Perfectly matched to LoopStart and LoopStep - seamless workflow!
Perfect for:
- Statisticians Moments & key figures
- Financial Analysts Key figure calculation
- Engineers Technical analysis
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