首页 > 解决方案 > 比较 Azure 数据工厂表达式中的日期

问题描述

当我今天在我的 IF 条件活动中运行此表达式时,此表达式的评估结果为 false

@equals(
activity('Pick the 4th working day').output.firstRow,
formatDateTime(utcnow(),'MM-dd-yyyy'))

但是,我得到了 Pick the 4th working day as

Output
{
    "firstRow": {
        "4thWorkingDay": "03-04-2021"

任何想法?

标签: azureazure-data-factory

解决方案


在您的情况下,此表达式的输出activity('Pick the 4th working day').output.firstRow是 Object 类型,但formatDateTime(utcnow(),'MM-dd-yyyy')' 的结果是 String 类型。这就是他们不平等的原因。

{
        "4thWorkingDay": "03-04-2021"
        ........
}

解决方案:使用以下表达式:

@equals(
activity('Pick the 4th working day').output.firstRow['4thWorkingDay'],
formatDateTime(utcnow(),'MM-dd-yyyy'))

我的测试:

在此处输入图像描述

在此处输入图像描述

在此处输入图像描述


推荐阅读