Home > Blockchain >  Removing .csv from @item().name in ADF
Removing .csv from @item().name in ADF

Time:09-13

In my Sink Table Name, I have the below paremeter:

@item().name

but it is creating the table as xxxxx.csv

What can I do to get rid of the .csv portion of the itemname when creating the sink table parameter. I found that I need to use Split() but it didn't work for me:

Split(@item().name,".",1)

Please note that I can't use substring because the parameter will refer to different table names with different lengths. So my approach was to look at the as a separator and extract the characters before it as my table name.

CodePudding user response:

I have reproduced the issue and the dynamic content you are using has incorrect syntax.

  • This is a sample array that I have taken.
[{"name":"file1.csv"},{"name":"file2.csv"}]
  • Inside for each, in a set variable activity, I used the following to extract just the filename (without '.csv').
@split(item().name,'.')[0]

enter image description here

  • The following is the debug output:

enter image description here

  • So, please change the dynamic content to @split(item().name,'.')[0].
  • Related