I am trying to use a Lookup Activity to return a row count. I am able to do this, but once I do, I would like to run an If Statement against it and if the count returns more than 20MIL in rows, I want to execute an additional pipeline for further table manipulation. The issue, however, is that I can not compare the returned value to a static integer. Below is the current Dynamic Expression I have for this If Statement:
@greater(int(activity('COUNT_RL_WK_GRBY_LOOKUP').output),20000000)
and when fired, the following error is returned: { "errorCode": "InvalidTemplate", "message": "The function 'int' was invoked with a parameter that is not valid. The value cannot be converted to the target type", "failureType": "UserError", "target": "If Condition1", "details": "" }
Is it possible to convert this returned value to an integer in order to make the comparison? If not, is there a possible work around in order to achieve my desired result?
Looks like the issue is with your dynamic expression. Please correct your dynamic expression similar to below and retry.
If
firstRowOnlyis set to true :@greater(int(activity('COUNT_RL_WK_GRBY_LOOKUP').output.firstRow.propertyname),20000000)If
firstRowOnlyis set to false :@greater(int(activity('COUNT_RL_WK_GRBY_LOOKUP').output.value[zero based index].propertyname),20000000)The lookup result is returned in the
outputsection of the activity run result.firstRowOnlyis set to true (default), the output format is as shown in the following code. The lookup result is under a fixed firstRow key. To use the result in subsequent activity, use the pattern of@{activity('MyLookupActivity').output.firstRow.TableName}. Sample Output JSON code is as follows:firstRowOnlyis set to false, the output format is as shown in the following code. A count field indicates how many records are returned. Detailed values are displayed under a fixed value array. In such a case, the Lookup activity is followed by a Foreach activity. You pass the value array to the ForEach activity items field by using the pattern of@activity('MyLookupActivity').output.value. To access elements in the value array, use the following syntax:@{activity('lookupActivity').output.value[zero based index].propertyname}. An example is@{activity('lookupActivity').output.value[0].tablename}. Sample Output JSON Code is as follows:Hope this helps.