I am trying to select the last string after splitting it in Azure Data Factory.
My file name looks like this:
s = "cloudboxacademy/covid19/main/ecdc_data/hospital_admissions.csv"
With Python I would use s.split('/')[-1]
to get the last element, according to
CodePudding user response:
The pipeline expression builder might be considering the value generated by split(dataset().fileName,'/')
as a string (array as a string) but not as an array itself. Hence the message Cannot fit string list item into the function parameter string.
- However, while executing, it is giving the expected output.
- To make it so that the warning
Cannot fit string list item into the function parameter string
is not shown, you can explicitly convert the result ofsplit
to an array usingarray
function. You can still chain the function using the following dynamic content and get expected result:
@last(array(split(dataset().filename,'/')))