Hi,
For the sake of the demo, this is the table which I used:
create table T(id int, MyfileName nvarchar(100))
GO
The issue in your app is in the file content. You use the Current Item
which is the JSON returned from previous steps. What you need is to first add the name of the columns and then the content of the column as in the following screenshot.
Note! By default you might only see the option current item
in the dynamic content windows. If you do not see the option of selecting the ResultSet columns, then you can start to type and the Portal should present you the columns. Another option is to do this by edit the code -> on the left menu click on and in the code fid the place where the body of the file is configured, under the
For_Each
section
Each column that you want to use should be added like @{items('For_each')?['Column Name Come Here']}
For example, check the following code
"For_each": {
"actions": {
"Create_file": {
"inputs": {
"body": "id,MyfileName,Folder\n@{items('For_each')?['id']} ,@{items('For_each')?['MyfileName']} ,@{items('For_each')?['Folder']}",
"headers": {
"ReadFileMetadataFromServer": true
},
"host": {
"connection": {
"name": "@parameters('$connections')['azurefile']['connectionId']"
}
},
"method": "post",
"path": "/datasets/default/files",
"queries": {
"folderPath": "/users01/@{items('For_each')?['Folder']}",
"name": "@{items('For_each')?['MyfileName']}.csv",
"queryParametersSingleEncoded": true
}
},
"runAfter": {},
"runtimeConfiguration": {
"contentTransfer": {
"transferMode": "Chunked"
}
},
"type": "ApiConnection"
}
},
Update: tip
Instead of configure the content directly in the CREATE FILE
action, you can use variable which make it simpler to control
In this case, since you set the Variable action inside a foreach loop, you must enable concurrency control for the foreach
loop and set its degree of parallelization to 1.