This site is in read only mode. Please continue to browse, but replying, likes, and other actions are disabled for now.

⚠️ We've moved!

Hi there!

To reduce project dependency on 3rd party paid services the StackStorm TSC has decided to move the Q/A from this forum to Github Discussions. This will make user experience better integrated with the native Github flow, as well as the questions closer to the community where they can provide answers.

Use 🔗 Github Discussions to ask your questions.

Orquesta workflows || YaqlEvaluation No functi on "dict" matches supplied arguments

Hi Team,
we are trying to loop the dict values in the Orquesta workflows .however we got the error.

Variable name : sql_server_report
output:
run:
exit_code: 0
result:
output: "{1=>‘DESTD01__SQLHealthCheckResults2021-08-05.html’,2=>‘GSQL01__SQLHealthCheckResults2019-06-24T06.00.01.8333200-0600.html’}
"
Error :
result:
errors:

  • message: ‘YaqlEvaluationException: Unable to evaluate expression ‘’<% dict(ctx().sql_server_report).values() %>’’. NoMatchingFunctionException: No functi
    on “dict” matches supplied arguments’

workflow design :

next:
- when: “{{ succeeded() }}”
publish:
- sql_server_report: “{{ result().output.run.result.output | to_json_string }}”
- report_file_check: true
- run: “{{ result().output.run }}”
do:
- report_file_content
- when: “{{ failed() }}”
publish:
- error_message: “{{ result().output.run.result.details.result_set[0].value._error.msg + ‘\n’ }}”
- error_output: “{{ result().output.run.result.details.result_set[0].value._output if ‘_output’ in result().output.run.result.details.result_set[0].value else ‘’ }}”
- run: “{{ result().output.run.result.details.result_set[0].value._error.msg }}”
- run_error: true
- report_file_check: false
do:
- fail
report_file_content:
with: <% dict(ctx().sql_server_report).values() %>
action: core.echo message=<% item() %>
next:
- when: “{{ succeeded() }}”
do:
- noop
- when: “{{ failed() }}”
do:
- noop

while execute the command with: <% dict(ctx().sql_server_report).values() %> got the below error.

result:
errors:

  • message: 'YaqlEvaluationException: Unable to evaluate expression ‘’<% dict(ctx().sql_server_report).values() %>’’. NoMatchingFunctionException: No functi
    on “dict” matches supplied arguments’

It looks like ctx().sql_server_report is a string - given the call to to_json_string, and there isn’t a YAQL function dict that takes a string - Standard YAQL Library — yaql documentation.

Hi

i have tried as per your idea,

publish:
- sql_server_report: “{{ result().output.run.result.output | to_json_string }}”

report_file_content:
with: <% dict(ctx().sql_server_report).values() %>
action: core.echo message=<% item() %>
next:
- when: “{{ succeeded() }}”
do:
- noop
- when: “{{ failed() }}”
do:
- noop

still got the below error

  • message: ‘YaqlEvaluationException: Unable to evaluate expression ‘’<% dict(ctx().sql_server_report).values() %>’’. NoMatchingFunctionException: No functi
    on “dict” matches supplied arguments’

What did you change? I can’t see a difference.

I’d take a look at the yaqluator with the input that you have, to help locate the right yaql expression. As I’m not sure exactly what you are trying to pass to the dict, but dict is not expecing a string.

e.g.

dict(1=>"ABC",2=>"DEF")

is valid, but not

dict({1=>"ABC",2=>"DEF"})

I couldn’t work out exactly what type of object you have in sql_server_report, but there is online yaqlevaluator that can be useful to help track down the exact yaql you need.

Hi Amanda,

next:
- when: “{{ succeeded() }}”
publish:
- sql_server_report: “{{ result().output.run.result.output}}”
- report_file_check: true

sql_server_report: "‘1’=>“DESTD01__SQLHealthCheckResults2021-08-05.html”,‘2’=>“BASQL01__SQLHealthCheckResults2019-06-24T06.00.01.8333200-06
00.html”

while we used the sql_server_report in the below task

with: <% dict(ctx(sql_server_report)).values() %>
action: core.echo message=<% item() %>

  • message: ‘YaqlEvaluationException: Unable to evaluate expression ‘’<% dict(ctx(sql_server_report)).values() %>’’. NoMatchingFunctionException: No function
    “dict” matches supplied arguments’

please help.

So I think the problem is that you are passing a string, albeit one that is "‘1’=>“DESTD01__SQLHealthCheckResults2021-08-05.html”,‘2’=>“BASQL01__SQLHealthCheckResults2019-06-24T06.00.01.8333200-06
00.html”’

So essentially you are passing to dict(“1=>ABC,2=>DEF”) rather than dict(1=>ABC,2=>DEF)

I’m not sure how to get it converted into a dict, but if you just want an array with what is after the =>, you could do something like, splitting your string by , and then selecting the values after =>, e.g.

<% ctx().sql_server_report.split(",").select($.rightSplit("=>")[1]) %>

That was from playing with http://yaqluator.com/, but hopefully that gives you a better clue of what is wrong and how to resolve.

Thanks for the update. will check.