Azure-docs: How to retrieve variables set in pipeline with dynamic content feature ?

Created on 26 Mar 2019  Â·  7Comments  Â·  Source: MicrosoftDocs/azure-docs

Hello,

I need to retrieve a variable that I set and populate in my pipeline to be used later on in the workflow, thanks to dynamic content feature. Could you please tell me how to do that ?

Thank you


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

cxp data-factorsvc product-question triaged

Most helpful comment

@MartinJaffer-MSFT thank you for the tips !

All 7 comments

@bertrandpons Thank you for the question! In order to best address your question, could you provide us with the URL of the MS Doc that you were following, if any?

@BhargaviAnnadevara-MSFT Thank you for your quick reply. I took a look into this doc: https://docs.microsoft.com/en-us/azure/data-factory/control-flow-expression-language-functions but I didn't find anything that fits my need.

@bertrandpons Thank you for the response! I've routed this to the appropriate Team to investigate further and update.

@bertrandpons There are two ways to access the value of a variable.

To access the value stored in a variable at any given point of time, use:
"@variables('myVariableName')"

To access the value circa a Set Variable activity use:
"@activity('mySetVariableActivityName').value"

@MartinJaffer-MSFT Thank you ! I have another related question: as I retrieve file name of blobs stored in Azure Storage with Get Metadate task, I then filter the output with Filter to get the file name I am looking for. From there I want to store this filtered file name in a variable but I can't get the name and only the name of the file... Do you have an idea of how to do that ?

As an example, here are the outputs:
Get Metadata (Child Items):

{
    "childItems": [
        {
            "name": "AddressFormatConfig1.xlsx",
            "type": "File"
        },
        {
            "name": "20190325.log",
            "type": "File"
        },
        {
            "name": "ExportedTemplate.zip",
            "type": "File"
        }
    ],
    "effectiveIntegrationRuntime": "DefaultIntegrationRuntime (West Europe)",
    "executionDuration": 38
}

Filter (on file with Exported in it):

{ 
   "ActivityRunId": "xxxxxxxxxx",
    "Status": "Succeeded",
    "Error": {
        "Message": "",
        "ErrorCode": ""
    },
    "Output": {
        "ItemsCount": 4,
        "FilteredItemsCount": 1,
        "Value": [
            {
                "name": "ExportedTemplate.zip",
                "type": "File"
            }
        ]
    }
}

Set Variable (from this filtered filename):

{
    "name": "filename",
    "value": [
        {
            "name": "ExportedTemplate.zip",
            "type": "File"
        }
    ]
}

In this latest task, I'd like to have as an output only _ExportedTemplate.zip_ and not all the JSON.

Thank you for your help

If your filter will ever only return 1 filename:
@activity('FilterActivityName').output.value[0].name

If your filter can return multiple files, then you would want to change your variable to an array type, change Set Variable activity to Append Variable activity, and use a ForEach activity.
image

image

@MartinJaffer-MSFT thank you for the tips !

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mrdfuse picture mrdfuse  Â·  3Comments

Favna picture Favna  Â·  3Comments

spottedmahn picture spottedmahn  Â·  3Comments

AronT-TLV picture AronT-TLV  Â·  3Comments

monteledwards picture monteledwards  Â·  3Comments