【问题标题】:ADF adding equals condition to existing if conditionADF 将等于条件添加到现有 if 条件
【发布时间】:2022-11-08 17:57:08
【问题描述】:

我在 ADF 活动中有一个 if 条件,如下所示:

@if(    
    contains(activity('LookupWmkLastUpdateConfig').output,'firstRow')
    ,greater(
        activity('LookupLastUpdateSrc').output.lastModified
        ,activity('LookupWmkLastUpdateConfig').output.firstRow.NewValueWatermark)
    ),
    false)

if 条件看起来是 src 与我的数据库中的最后更新日期。我想要包含的是一个额外的代码块,它评估一个名为 TypeLoad 的外部参数。 当前设置仅允许满载,我希望能够包括增量负载。

有谁知道如何将这样一段逻辑包含到现有的 if 代码中?

equals(pipeline().parameters.FwkItem['TypeLoad'],1)

例如,上述条件将评估全负载或增量负载。

非常欢迎所有帮助。

谢谢!

【问题讨论】:

  • 你能告诉我们你到目前为止所做的尝试吗?
  • @and(equals(pipeline().parameters.FwkItem['TypeLoad],1),if(contains(activity('LookupWmkLastUpdateConfig').output,'firstRow'),greater(activity('LookupLastUpdateSrc').output.lastModified ,activity('LookupWmkLastUpdateConfig').output.firstRow.NewValueWatermark)),false) -> 如果不接受 2 个参数,这会给函数抛出错误。
  • 您需要将“if”移到外部,因此“and”是 if 中的条件,也许是这样的:@if(and(equals(pipeline().parameters.FwkItem['TypeLoad],1),contains( activity('LookupWmkLastUpdateConfig').output,'firstRow'),greater(activity('LookupLastUpdateSrc').output.lastModified,activity('LookupWmkLastUpdateConfig').output.firstRow.NewValueWatermark)),false)
  • 然后返回:函数“和”不接受 3 个参数

标签: azure conditional-statements azure-data-factory etl


【解决方案1】:

我试图在我的环境中重现这一点。我给了同样的表情

@if(    
    contains(activity('LookupWmkLastUpdateConfig').output,'firstRow')
    ,greater(
        activity('LookupLastUpdateSrc').output.lastModified
        ,activity('LookupWmkLastUpdateConfig').output.firstRow.NewValueWatermark)
    ),
    false)

  • 同样的错误函数“if”不接受 2 个参数发生。
  • 在查看表达式错误原因时,,activity('LookupWmkLastUpdateConfig').output.firstRow.NewValueWatermark) ) 附近有两个右括号。
  • 上图中突出显示了相同的内容。
  • 删除一个括号并给出如下图所示的表达式。
@and(equals(pipeline().parameters.fwkitem,1),if(contains(activity('LookupWmkLastUpdateConfig').output,'firstRow'),greater(

activity('LookupLastUpdateSrc').output.lastModified

,activity('LookupWmkLastUpdateConfig').output.firstRow.NewValueWatermark)

,false))

表达式现在不会产生任何错误。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-10-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-12-01
    • 2012-09-22
    • 2019-05-26
    • 1970-01-01
    相关资源
    最近更新 更多