'Expression to check if a given string exist in a output of a script task in ADF
I get following result from my script task, How should I build expression to check if the result contains 'exceed'
{ "resultSetCount": 1, "recordsAffected": 0, "resultSets": [ { "rowCount": 2, "rows": [ { "status": "exceed" }, { "status": "pass" } ] } ],
Solution 1:[1]
You could just the contains function in the Azure Data Factory expression language. In this example, I have used a parameter to hold the string value as I can't easily reproduce your script, but it should work for your example:
@contains(pipeline().parameters.pInput, 'exceed')
contains
returns a boolean value so I am assigning it in a Set Variable activity just as an example:
This is obviously a bit of a blunt instrument and using string methods rather than working with the json methods. If you wanted to, you could loop through each row with a For Each activity but it hardly seems worth it. Set the items
of a For Each activity to something like this to loop through each row:
@json(pipeline().parameters.pInput).resultSets[0].rows
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |