在Azure数据工厂中将行计数转换为INT [英] Convert Row Count to INT in Azure Data Factory

查看:49
本文介绍了在Azure数据工厂中将行计数转换为INT的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Lookup Activity返回行数.我能够做到这一点,但是一旦我做到了,我想对它运行一个If语句,如果计数返回的行数超过20MIL,我想执行一个额外的管道以进一步进行表操作.但是,问题是我无法将返回值与静态整数进行比较.下面是此If语句的当前动态表达式:

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(活动('COUNT_RL_WK_GRBY_LOOKUP'.输出),20000000)

@greater(int(activity('COUNT_RL_WK_GRBY_LOOKUP').output),20000000)

,并在触发后返回以下错误:{"errorCode":"InvalidTemplate","message":使用无效的参数调用了函数'int'.该值无法转换为目标类型","failureType":"UserError","target":如果Condition1",细节": ""}

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.

  • 如果 firstRowOnly 设置为true: @greater(int(activity('COUNT_RL_WK_GRBY_LOOKUP'.output.firstRow.propertyname),20000000)

如果 firstRowOnly 设置为false: @greater(int(activity('COUNT_RL_WK_GRBY_LOOKUP'.. output.value [基于零的索引].属性名称),20000000)

If firstRowOnly is set to false : @greater(int(activity('COUNT_RL_WK_GRBY_LOOKUP').output.value[zero based index].propertyname),20000000)

查找结果在活动运行结果的 output 部分中返回.

The lookup result is returned in the output section of the activity run result.

{
    "firstRow":
    {
        "Id": "1",
        "TableName" : "Table1"
    }
}

  • firstRowOnly 设置为false时,输出格式如下代码所示.计数字段指示返回多少记录.详细值显示在固定值数组下.在这种情况下,Lookup活动之后是Foreach活动.通过使用 @activity('MyLookupActivity').output.value 的模式,将值数组传递到ForEach活动项目字段.要访问值数组中的元素,请使用以下语法: @ {activity('lookupActivity').output.value [基于零的索引] .propertyname} .一个示例是 @ {activity('lookupActivity').output.value [0] .tablename} .示例输出JSON代码如下:
    • When firstRowOnly is 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:
    • {
          "count": "2",
          "value": [
              {
                  "Id": "1",
                  "TableName" : "Table1"
              },
              {
                  "Id": "2",
                  "TableName" : "Table2"
              }
          ]
      }
      

      希望这会有所帮助.

      这篇关于在Azure数据工厂中将行计数转换为INT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆