06 May 2025 02:16 AM
This is related to my prior topic here https://community.dynatrace.com/t5/DQL/Davis-Analyzer-limits-how-to-chunk-up-the-dimensions/td-p/275... and I found a similar issue but could not follow its advice here https://community.dynatrace.com/t5/Automations/Workflows-get-data-from-a-previous-dql-task-to-a-new-....
I have a task 'filter_hosts' that is outputting a list of dictionaries containing list of Hosts I want to iterate over in a subsequent task.
A stylized summary response from 'filter_hosts' resembles:
[
{
"types":[{...}],
"records:" [
{"hostId":"HOST-abc"},
...,
{"hostId":"HOST-xyz"}
]
},
{
"types":[{...}],
"records:" [
{"hostId":"HOST-123"},
...,
{"hostId":"HOST-789"}
]
}
]
In the second task 'process_hosts' after filter_hosts Tasks I am trying to setup a Task Input loop that I cannot get working. The Loop input List is defined as:
{% for hostList in result("filter_hosts") %}
{{hostList.records}}
{% endfor %}
I have a simple DQL that tries to access the loop variable but at runtime I get the error:
Invalid loop items in task 'process_hosts'. The value is not a list.
But I can't get any more runtime log data to help me out. I've played around with variations of the expression for the Loop List but am no closer.
Any ideas on how to adjust the Input definition? Thanks!
08 May 2025 02:32 PM
Ok I tried your suggestion but got : "Error evaluating loop expression. 'records' is undefined in the result of task 'filter_hosts'
For normal Task output you're right that .records should be a top-level key in the Dictionary {} response but in this case records is nested within in a containing List [] and repeated several times. Is why I am struggling with this one.