You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

请求解析Azure Data Factory筛选活动中的条件表达式

Azure Data Factory筛选活动表达式解析

原表达式

@if(equals(pipeline().parameters.FileName,'default'),endswith(toUpper(item().name),'.PDF'),
and(startswith(item().name,replace(string(pipeline().parameters.Filemane),'*.txt','')),
endswith(toUpper(item().name),'.PGP')))

逻辑解析

这是一个条件筛选规则,完全根据管道参数FileName的值来决定筛选文件的标准:

  • 当FileName参数等于'default'时:筛选所有文件名转大写后以.PDF结尾的文件(不区分原文件名大小写,比如report.pdf、DATA.Pdf都会被选中)。
  • 当FileName参数不等于'default'时:必须同时满足两个条件才会被筛选:
    1. 文件名以「FileName参数去掉*.txt后缀后的字符串」开头(比如FileName是'invoice*.txt',就提取'invoice'作为前缀,invoice_2024.pgp、invoiceData.PGP都符合开头要求);
    2. 文件名转大写后以.PGP结尾(同样不区分原文件名大小写)。

修正与优化版本

原表达式存在拼写错误:pipeline().parameters.Filemane应为pipeline().parameters.FileName(少了字母i),修正后更易读的写法如下:

@if(
    equals(pipeline().parameters.FileName, 'default'),
    endswith(toUpper(item().name), '.PDF'),
    and(
        startswith(item().name, replace(string(pipeline().parameters.FileName), '*.txt', '')),
        endswith(toUpper(item().name), '.PGP')
    )
)

内容的提问来源于stack exchange,提问作者Avenue Guy

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.11 22:00:58