Instead of using search records, I would the Make a Request step to search for your records and return a JSON object of them, then use another Make a Request step to sum the data.
As a little bit of an example, where I loop through records and create a time card up until a timestop variable:
My current Step B:
{#
FID 8 = Related Job
FID 13 = PGE Work Request Record ID (KEY)
FID 33 = PM Hours Remaining > 0
FID 35 = Total Hours Remaining > 0
FID 36 = Job - Related Customer
FID 37 = PM Automation Eligible
FID 38 = Alternate PM Automation Eligible
FID 41 = Project Completion %
#}
{
"from": "MyTableID",
"select": [
8,
13,
33,
35,
36,
41
],
"where": "{37.EX.'1'}AND{8.EX.'{{a.related_job | int}}'}",
"sortBy": [
{
"fieldId": 41,
"order": "DESC"
},
{
"fieldId": 33,
"order": "ASC"
},
{
"fieldId": 35,
"order": "DESC"
}
]
}
My current Step C:
{
{% set myDataSet = "MyTableID" %}
{% set myTimeStop = namespace(val=a.hours) %}
{% set myTimeLimit = namespace(val=a.time_limit_variable) %}
{% set runningTotal = namespace(val=0.0) %}
{% set relatedTimeSheet = namespace(val=a.related_time_sheet) %}
{% set relatedWorkCode = namespace(val=a.related_work_code) %}
{% set relatedClass = namespace(val=a.related_class) %}
"to": "{{myDataSet}}",
"data":[
{% for row in (b.json.data) if runningTotal.val < myTimeStop.val %}
{% set remainingTime = myTimeStop.val - runningTotal.val %}
{% set currentTimeLimit = remainingTime if remainingTime <= myTimeLimit.val else myTimeLimit.val %}
{% set currentValue = row['33'].value if row['33'].value <= currentTimeLimit else currentTimeLimit %}
{% set runningTotal.val = runningTotal.val + currentValue %}
{
"37":{
"value": "{{row['36'].value | int}}"
},
"39":{
"value": "{{row['8'].value | int}}"
},
"28":{
"value": "{{relatedWorkCode.val | int}}"
},
"42":{
"value": "{{relatedClass.val | int}}"
},
"655":{
"value": "{{row['13'].value | int}}"
},
"227":{
"value": "{{currentValue}}"
},
"34":{
"value": "{{relatedTimeSheet.val | int}}"
},
"742":{
"value": "{{a.id | int}}"
},
"32":{
"value": "0"
},
"108":{
"value": "M-Level Time Automation"
}
}
{% if loop.last == false and runningTotal.val <= myTimeStop.val %},{% endif %}
{% endfor %}
]
}
------------------------------
Dwight Munson
------------------------------