如何解决 'lastindexof' 是一个原语,不支持 Azure 数据工厂中的嵌套属性
How to work around 'lastindexof' is a primitive and doesn't support nested properties in Azure Data Factory
我正在尝试获取数据工厂中的现有文件名并使用动态内容重新排列它,以便它附加有时间戳。但是我似乎收到以下错误:
Position 172 'lastindexof' is a primitive and doesn't support nested properties.
看来我不能将计算放在其他函数的参数中,这确实有限制。有什么解决方法吗?我是否应该查看数据工厂中的另一个组件以更轻松地实现此目的?
请看下面的动态内容表达:
@concat(substring(item().name, 0, lastindexof(item().name, '.')), '_', formatDateTime(utcnow(),'yyyyMMddhhmmss'), '.', substring(item().name, lastindexof(item().name, '.') + 1, length(item().name) - lastindexof(item().name, '.') - 1))
我想要实现的基本测试是获取输入文件名 abc.csv
或 xyz.xlsx
并将其转换为 abc_20200213131301.csv
或 xyz_20200213131301.xlsx
.
你正在尝试的东西会起作用,我已经做到了,但是会有太多的“(”和“,”
您可以尝试使用 2 个设置变量 activity 和拆分函数来实现。
第一 Activity
使用拆分函数:@split(variables('FileName'),'.')
第二 Activity
@concat(变量('SplitFileName')[0],'_',formatDateTime(utcnow(),'yyyyMMddhhmmss'),'.',变量('SplitFileName')1)
你可以尝试这样的事情。
@concat(substring(item().name,0,lastindexof(item().name,'.')),'_',formatDateTime(utcnow(),'yyyyMMddhhmmss'), replace(item().name,substring(item().name,0,lastindexof(item().name,'.')),''))
另一种选择是使用 add
或 sub
函数。为了找到最后一个“.”之后的剩余字符,我使用了 sub
函数。
@concat(substring(item().name,0,lastindexof(item().name,'.')),'_',formatDateTime(utcnow(),'yyyyMMddhhmmss'), substring(item().name, lastindexof(item().name,'.'), sub(length(item().name), lastindexof(item().name, '.'))))
我正在尝试获取数据工厂中的现有文件名并使用动态内容重新排列它,以便它附加有时间戳。但是我似乎收到以下错误:
Position 172 'lastindexof' is a primitive and doesn't support nested properties.
看来我不能将计算放在其他函数的参数中,这确实有限制。有什么解决方法吗?我是否应该查看数据工厂中的另一个组件以更轻松地实现此目的?
请看下面的动态内容表达:
@concat(substring(item().name, 0, lastindexof(item().name, '.')), '_', formatDateTime(utcnow(),'yyyyMMddhhmmss'), '.', substring(item().name, lastindexof(item().name, '.') + 1, length(item().name) - lastindexof(item().name, '.') - 1))
我想要实现的基本测试是获取输入文件名 abc.csv
或 xyz.xlsx
并将其转换为 abc_20200213131301.csv
或 xyz_20200213131301.xlsx
.
你正在尝试的东西会起作用,我已经做到了,但是会有太多的“(”和“,”
您可以尝试使用 2 个设置变量 activity 和拆分函数来实现。
第一 Activity
使用拆分函数:@split(variables('FileName'),'.')
第二 Activity
@concat(变量('SplitFileName')[0],'_',formatDateTime(utcnow(),'yyyyMMddhhmmss'),'.',变量('SplitFileName')1)
你可以尝试这样的事情。
@concat(substring(item().name,0,lastindexof(item().name,'.')),'_',formatDateTime(utcnow(),'yyyyMMddhhmmss'), replace(item().name,substring(item().name,0,lastindexof(item().name,'.')),''))
另一种选择是使用 add
或 sub
函数。为了找到最后一个“.”之后的剩余字符,我使用了 sub
函数。
@concat(substring(item().name,0,lastindexof(item().name,'.')),'_',formatDateTime(utcnow(),'yyyyMMddhhmmss'), substring(item().name, lastindexof(item().name,'.'), sub(length(item().name), lastindexof(item().name, '.'))))