question

TalZadok-4082 avatar image
0 Votes"
TalZadok-4082 asked MartinJaffer-MSFT commented

ADF: complex parameter reference

I have 2 pipelines: master and child.
master pipeline contains a foreach loop which calls the child pipeline (execute pipeline activity).
the child pipeline contains a single activity of data explorer command.
foreach item is being passed as parameter to child pipeline.

1 - in master pipeline, how can I define an array of complex objects to iterate in foreach?
using square brackets with complex objects raised an error.
probably something like:
@createArray( json('{"cloudEnv": "ffx", "states": ["a", "b"]}'), json('{"cloudEnv": "mck", "states": ["c"]}')) ?

2 - how can I reference a sub-field (e.g "states") in the child pipeline, within the kusto query?
tried "mytable | where State in [pipeline().parameters.cloudobj].states" but that didn't work.


Thanks

azure-data-factory
· 8
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @TalZadok-4082 and welcome to Microsoft Q&A.

I think I understand ask #1. For ask #2 do you mean, how to reference and place inside a usable query?

0 Votes 0 ·

I believe I have reproduced the error of #1.

When running the child directly, with array type parameter and value [{"name":"foo","value":[2,3]},{"name":"var","value":[7,8]},{"name":"baz","value":[23,1]}] it runs fine. But then when I try to pass the same value through execute pipeline, I get error

Operation on target ForEach1 failed: The execution of template action 'MainForEach1' failed: the result of the evaluation of 'foreach' expression '@pipeline().parameters.asarray' is of type 'String'. The result must be a valid array.

Is this the same error you get, @TalZadok-4082 ?




0 Votes 0 ·

In the execute pipeline, I wrapped the value in @json('stuff_goes_here') and it worked. I will inquire/provide feedback to the product group about this.

 @json('[{"name":"foo","value":[2,3]},{"name":"var","value":[7,8]},{"name":"baz","value":[23,1]}]')

0 Votes 0 ·

Thanks

can you please specify how do you reference "value" in the child pipeline within an Azure Data Explorer query?
let's say I want to use "2,3" as part of the query (see below)

my configurations:
master pipeline:
82389-capture3.png

"Items" in foreach activity: @json('[ {"cloudEnv": "ffx", "states": ["a", "b"]}, {"cloudEnv": "mck", "states": ["c"]}]')"

child pipeline:
pipeline parameter:
82481-capture2.png

ADE command:
myTable | where State in [pipeline().parameters.cloudobj].states

the syntax is following this example: https://docs.microsoft.com/en-us/azure/data-factory/control-flow-expression-language-functions#complex-expression-example

output error:
82466-capture4.png

thanks


0 Votes 0 ·
capture3.png (57.9 KiB)
capture2.png (44.4 KiB)
capture4.png (40.9 KiB)
Show more comments

0 Answers