How to get how many file names/folder names are returned by getmetadata
activity in Azure data factory?
I want to get the number of files/folders returned by getmetadata
activity and on the basis of this count decide which activities will execute..
Anyone have any idea about how can we get this count?
Thanks to those who commented and special thanks to Steve Zhao.
Actually i wanted to check if files present i.e length is greater than 0 then go to flow A else Choose flow B.
I've tried standalone greater and length function in my expression (greater(length(activity('GETFILENAMESFROMBLOB').output.childitems), 0)) to calculate length but when child items are 0 but when i tried this previous activity i.e GETMETADATA doesn't contains childitems array in it's output so my If condition activity gives error that property childitems doesn't exist.
I also tried empty function but the main issue was when there are no input files for getmetadata then we should not expect a childitems array in it's output.
So here is how i have solved the problem, at first i checked if childitems array is present in output of my getmetadata activity, then we'll get the actual count using length function else expression will have to return 0. Below is the expression used for if condition Activity. Please check.
Expression:
@if( contains(activity('GETFILENAMESFROMBLOB').output,'childitems'), length(activity('GETFILENAMESFROMBLOB').output.childitems), equals(2,3))
Hope this may help you!