在JSON中格式化动态文件夹路径

时间:2018-12-03 19:17:58

标签: json azure azure-data-factory

寻求基本的代码格式帮助。

我要替换此代码:

{
"name": "BlobConnect",
"properties": {
    "linkedServiceName": {
        "referenceName": "BlobConnect",
        "type": "LinkedServiceReference"
    },
    "type": "AzureBlob",
    "typeProperties": {
        "fileName": "",
        "folderPath": "timtesting"
    }
},
"type": "Microsoft.DataFactory/factories/datasets"}

通过某些东西可以动态分配文件夹路径,无论当前日期是什么。另一个用户建议使用:

"folderPath": {
      "value": "@concat('test1/',
                formatDateTime(utcnow(),'yyyy'),'-', 
                formatDateTime(utcnow(),'MM'),'-',
                formatDateTime(utcnow(),'dd'))",
       "type": "Expression"}

,但是每次我用这个替换文件夹路径部分时,我都会继续遇到格式错误。我不确定到底是什么问题,有几个格式化站点确认这是不正确的,但我不确定如何解决。谢谢!

1 个答案:

答案 0 :(得分:0)

{
"name": "BlobConnect",
"properties": {
    "linkedServiceName": {
        "referenceName": "BlobConnect",
        "type": "LinkedServiceReference"
    },
    "type": "AzureBlob",
    "typeProperties": {
        "fileName": "",
        "folderPath": {
            "value": "@concat('timtesting/', formatdatetime(utcnow(),'yyyy'),'-',formatdatetime(utcnow(),'MM'),'-',formatdatetime(utcnow(),'dd'))",
            "type": "Expression"
        }
    }
},
"type": "Microsoft.DataFactory/factories/datasets"

}