Forum Discussion

tan_thiamhuat's avatar
tan_thiamhuat
Icon for Post Patron rankPost Patron
1 year ago
Solved

Copy Data in Fabric

I tested with it, whether there is data from the Source or not, it still goes to "On Success". What I need is when there is no data from the Source, it should go to "On fail".   Can anyone quickly...
  • v-prasare's avatar
    v-prasare
    1 year ago

    Hi tan_thiamhuat,

     

     

    start by configuring a Get Metadata activity. Use a dataset that points to your SFTP server, and apply a wildcard path such as customer_*.csv to target the expected files. In the field list of the activity, select Child Items.

     

    After setting up the metadata check, insert an If Condition activity named "If No File". Use the expression @equals(length(activity('Get Metadata - Customer File').output.childItems), 0) to evaluate whether any files were returned. If the result is true (i.e., no files found), route the pipeline to a Fail activity with an appropriate error message like "No customer files found in SFTP. Failing pipeline." If files are found (false path), the pipeline proceeds to a Copy Activity, where it transfers the files to the destination as per your data flow logic.

     

     

     

    Thanks,

    Prashanth Are

    MS Fabric community support