Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedJoin us at the 2025 Microsoft Fabric Community Conference. March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for $400 discount. Register now
Hello community - New to data factory. This is probably a easy fix and would appreciate any insight.
Scenario:
Summary:
The result of a file being dropped onto the SFTP server executes the .net program, the "Get List of Files" activity, the switch executes but does not find a match on the case so passes through to the delete which cleans up the decrypted file.
I'm totally lost and know it has something to do with the way its wired. I need help and would be super appreciative of your wisdom.
Solved! Go to Solution.
Thank you for your detailed response!!!
I found a different approach to the problem and setup a trigger on storage of the file from the .Net job on the Decrypted folder. The trigger is on file appearing in the decrypted folder and then evulating the pipeline().paramater.filename in the switch without the need for getting metadata. This has streamlined my approach.
Again, I very much appreciate you taking the time out of your busy day to provide me with your insight.
Your Switch activity has not the right values. One of the potential issues is that how the FileName parameter is passed or split. These are some of the things that you should test:
1. Make Sure the Filename is Actually Being Captured
Before the Switch activity, it is important to prove that the FileName parameter is assigned properly. Add a new Set Variable activity directly before the switch and write this:
@activity('Get List of Files').output.childItems[0].name
Then, execute the pipeline in Debug mode and check whether the file name appears as you expect.
2. Fix the Split Expression in Switch Activity
Right now, you are using:
split(pipeline().parameters.FileName, '_')[1]
The problem may be the file name as it may be loaded with a blank space causing the Switch to not match any cases. Adding a trim function will remove the spaces as well as other blank characters.
trim(split(pipeline().parameters.FileName, '_')[1])
Otherwise, if you’re concerned about having the wrong case, change it to lowercase explicitly:
toLower(trim(split(pipeline().parameters.FileName, '_')[1]))
This should make sure that the value matches with the case statements (Apple, Peaches, Pumpkin, etc.) exactly.
3. Double-Check the "Get List of Files" Output
During the process, go to the Debug output and check the following:
Are the filenames the correct ones that come back from it?
Do I need to loop through the files with a ForEach activity in case of multiple files?
The output may be completely empty, and the problem must have started from it!
4. Quick Fix for the Delete Activity
Despite the Switch not being able to match any folder, the file is removed anyway. It this behavior doesn’t match your expectation, a condition could be added before the Delete activity to check the right status which is true.
Next Steps
Add a Set Variable activity before the Switch → Print FileName in Debug
Fix the Split expression in the Switch
Check the Debug output of “Get List of Files”
Confirm case-sensitivity and spaces in filenames
Thank you for your detailed response!!!
I found a different approach to the problem and setup a trigger on storage of the file from the .Net job on the Decrypted folder. The trigger is on file appearing in the decrypted folder and then evulating the pipeline().paramater.filename in the switch without the need for getting metadata. This has streamlined my approach.
Again, I very much appreciate you taking the time out of your busy day to provide me with your insight.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!
Check out the February 2025 Fabric update to learn about new features.
User | Count |
---|---|
6 | |
3 | |
2 | |
1 | |
1 |
User | Count |
---|---|
9 | |
9 | |
6 | |
5 | |
4 |