Loop through a list and get each value in the list RRS feed

  • Question

  • I have a folder in ADLS that has few files. For the purpose of understanding, I will keep it simple. I have the following three files. When I loop through this folder, I want to get the "file name" and "source" as separate parameters so that I can pass it subsequent activities/pipelines.




    I want to put this in an array so that it can be passed accordingly to the subsequent activities.

    (employee, contractor, manager_director)

    (crm, ps, sap)

    I want to pass two parameters to my subsequent activity (may be a stored procedure) as usp_foo (employee, crm) and it will execute the process based on the parameters. Similary, usp_foo (contractor, ps) and usp_foo (manager_director, sap). 

    How do I get the child items as two separate parameters so that it can be passed to SP?

    Known is a DROP, Unknown is an OCEAN.

    Wednesday, May 27, 2020 9:23 PM

All replies

  • Hello Bangaaram and thank you for your question.

    It looks like you want to take a filename and split it into 2 parts.  Given your examples it looks like your logic goes like:

    1. Get from the start to the last underscore (_)
    2. Get from the last underscore to the period/dot (.) of the suffix.

    To put things in an array, we will use an "append variable" activity.  If you want the order to be reliable, you must use the "sequential" feature in the forEach loop activity.

    To implement the above logic, I will use the following expressions in the append variable activities.


    The above gets the first part.  Substring has the arguments ( string_to_cut, start_index, length_to_keep).  Since we want to start at the beginning, the start_index is 0, and we want to keep all the way until the last underscore (_).


    The above gets the last part.  I have spaced it out for easier reading.
    Again we use substring, but we want to start after the last underscore (_) , so w start at the index of the last underscore plus 1.  The length we want to keep, is the index of the dot/period (.) minus our start position.

    This logic assumes you never have an underscore after a dot/period.  It also assumes there is always at least one underscore and at least one dot/period.

    Thursday, May 28, 2020 8:55 PM
  • We have not received a response from you.  Are you still facing the issue?  If you found a solution, would you please share it here with the community?  Otherwise, let us know and we will continue to engage with you on the issue.
    Tuesday, June 2, 2020 1:43 AM