Ivan, this doesn't work, it seems that if there are no rows, the post is never made regardless of the expression?
In the Endpoint Test dialog, the expression works if the input record is {}, but not if it is empty, and apparently that is what happens when there are no rows.
Here is what I see in the Connection Manager Log:
16/12/2025 15:39:06| Evaluate template: {{= { data: batch || [ {} ] } }}
--- Parameter 'resource': {
"name": "YediotTasksProd"
}
16/12/2025 15:39:06| Template evaluation result: {
"data": []
}
16/12/2025 15:39:06| Evaluate template: {{=response.o_result}}
--- Parameter 'resource': {
"name": "YediotTasksProd"
}
16/12/2025 15:39:06| Template evaluation result:
16/12/2025 15:39:06| Evaluate template: {{=response.o_result}}
--- Parameter 'resource': {
"name": "YediotTasksProd"
}
I also tried checking the batch.length, which shows the full blank set in the evaluation result, but still never post to the api:
16/12/2025 15:48:21| Evaluate template: {{= { data: batch.length>0 ? batch : [ {} ] } }}
--- Parameter 'resource': {
"name": "YediotTasksProd"
}
16/12/2025 15:48:21| Template evaluation result: {
"data": [
{}
]
}
16/12/2025 15:48:21| Evaluate template: {{=response.o_result}}
--- Parameter 'resource': {
"name": "YediotTasksProd"
}
16/12/2025 15:48:21| Template evaluation result:
16/12/2025 15:48:21| Evaluate template: {{=response.o_result}}
--- Parameter 'resource': {
"name": "YediotTasksProd"
}
I considered modifying my source SQL to add a 'null' row when there are no records, that I could capture using
item.id = null in my template, but I couldn't find a syntax that would make that work either (item. seems to always be undefined).
Any other suggestions?