azure-data-factory

ADF Lookup Activity Output Parsing


I get the following output from my Lookup Activity.

{
    "firstRow": {
        "": "Product"
    },
    "effectiveIntegrationRuntime": "virtualnet (West Europe)",
    "durationInQueue": {
        "integrationRuntimeQueue": 0
    }
}

I have requirement to fetch "Product" value and return some data if the value is "Product".

pseudo code:

If value is "Product"
 return "This is Product"
Else
 return "This is Not a Product"

I tried the below:

@if(equals(activity('LookupProduct').output.firstRow, 'Product'),'This is product','This is not a product')

However, it always returns "This is not a product".


Solution

  • However, it always returns “This is not a product”.

    Here, you are checking the total firstRow object with the Product string. Thats the reason it’s always giving the false expression for you.

    As firstRow is containing the empty string as key, you can specify the same with [] notation as below.

    @if(equals(activity('LookupProduct').output.firstRow[''], 'Product'),'This is product','This is not a product')
    

    For sample, I took your input object in an object type pipeline parameter.

    enter image description here

    Now, it will give the expected result as shown below.

    enter image description here