<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Limitation of filter activity in foreach loop in Pipelines</title>
    <link>https://community.fabric.microsoft.com/t5/Pipelines/Limitation-of-filter-activity-in-foreach-loop/m-p/4234655#M5831</link>
    <description>&lt;P&gt;In the Foreach container you are already at the level of an item. The filter activity is intended more for filtering out multiple inputs that meet certain criteria.&lt;BR /&gt;Would it make sense for your use case to place the filter activity outside the loop container and to run through the foreach case in parallel with the already filtered items?&lt;BR /&gt;Or, if not, use a switch or if activity instead of the filter activity, for example?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;</description>
    <pubDate>Wed, 09 Oct 2024 06:27:51 GMT</pubDate>
    <dc:creator>Nico_Saar</dc:creator>
    <dc:date>2024-10-09T06:27:51Z</dc:date>
    <item>
      <title>Limitation of filter activity in foreach loop</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Limitation-of-filter-activity-in-foreach-loop/m-p/4233845#M5822</link>
      <description>&lt;P&gt;I have met a limitation where I want to use a filter activity inside a for each loop and where I want to use an attribute from my For Loop item() as my filtering condition in the filter activity. However when setting the condition of the Filter activity item() refers to the input of the filter activity and not the item() of the for each activity.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can work around this by adding item().object_name from the ForEach activity to a variable before passing it to the filter condition. But then I cannot run the for each loop in parallell which is a requirement in my case. Is there another way around this without adding nestled pipelines? It seems strange that both the filter activity and the for loop has the same item() syntax. Can the "ForEach item()" be accessed some other way?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/azure/data-factory/control-flow-filter-activity" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/en-us/azure/data-factory/control-flow-filter-activity&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2024 15:23:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Limitation-of-filter-activity-in-foreach-loop/m-p/4233845#M5822</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-10-08T15:23:20Z</dc:date>
    </item>
    <item>
      <title>Re: Limitation of filter activity in foreach loop</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Limitation-of-filter-activity-in-foreach-loop/m-p/4234286#M5829</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This forum is for discussing issues related to the Fabric Data Factory, for Azure issues you can go to the following link, there will be more professional people to help you solve the problem:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://techcommunity.microsoft.com/t5/azure-data-factory/bd-p/AzureDataFactory" target="_blank"&gt;Azure Data Factory - Microsoft Community Hub&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here are some possible ideas for your reference:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To solve this problem without using nested pipes, you can consider using the Set Variable activity in the ForEach loop to store the current item.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Inside the ForEach, add a Set Variable activity to store item().object_name.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Set the variable to @item().object_name.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use the variable in the Filter activity’s condition, for example, @equals(variables('yourVariableName'), item().name).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Nono Chen&lt;/P&gt;
&lt;P&gt;If this &lt;STRONG&gt;&lt;EM&gt;post&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;helps, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Oct 2024 01:36:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Limitation-of-filter-activity-in-foreach-loop/m-p/4234286#M5829</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-10-09T01:36:50Z</dc:date>
    </item>
    <item>
      <title>Re: Limitation of filter activity in foreach loop</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Limitation-of-filter-activity-in-foreach-loop/m-p/4234655#M5831</link>
      <description>&lt;P&gt;In the Foreach container you are already at the level of an item. The filter activity is intended more for filtering out multiple inputs that meet certain criteria.&lt;BR /&gt;Would it make sense for your use case to place the filter activity outside the loop container and to run through the foreach case in parallel with the already filtered items?&lt;BR /&gt;Or, if not, use a switch or if activity instead of the filter activity, for example?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Wed, 09 Oct 2024 06:27:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Limitation-of-filter-activity-in-foreach-loop/m-p/4234655#M5831</guid>
      <dc:creator>Nico_Saar</dc:creator>
      <dc:date>2024-10-09T06:27:51Z</dc:date>
    </item>
    <item>
      <title>Re: Limitation of filter activity in foreach loop</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Limitation-of-filter-activity-in-foreach-loop/m-p/4234667#M5832</link>
      <description>&lt;P&gt;I'm using Data factory in Fabric. I think that was made clear from the screenshot?&lt;/P&gt;&lt;P&gt;As for the variable my intial post stated that using a variable - since it's not thread safe - and therfore does not work in parallell is not a viable option.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Oct 2024 06:32:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Limitation-of-filter-activity-in-foreach-loop/m-p/4234667#M5832</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-10-09T06:32:05Z</dc:date>
    </item>
    <item>
      <title>Re: Limitation of filter activity in foreach loop</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Limitation-of-filter-activity-in-foreach-loop/m-p/4234716#M5835</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since you provided a link from azure, there may have been a misunderstanding.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As mentioned above, perhaps you can consider using variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.fabric.microsoft.com/t5/Data-Pipeline/How-to-do-nested-for-loops-in-data-factory/m-p/3786326" target="_blank" rel="noopener"&gt;Solved: Re: How to do nested for loops in data factory - Microsoft Fabric Community&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or try what&amp;nbsp;Nico_Saar&amp;nbsp;says.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Nono Chen&lt;/P&gt;
&lt;P&gt;If this &lt;STRONG&gt;&lt;EM&gt;post&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;helps, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Oct 2024 06:59:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Limitation-of-filter-activity-in-foreach-loop/m-p/4234716#M5835</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-10-09T06:59:59Z</dc:date>
    </item>
    <item>
      <title>Re: Limitation of filter activity in foreach loop</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Limitation-of-filter-activity-in-foreach-loop/m-p/4234872#M5838</link>
      <description>&lt;P&gt;Thanks, I appreciate your answer! I can try to describe the workflow a bit more carefully.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I’m trying to accomplish is to be able to move pipelines between workspaces (environments) without having to update anything codewise or metadata wise. We are using a metadata driven framework where we want to parameterize which notebook or pipeline to be run. Currently when parameterizing the notebook activity you need to specify the workspace and notebook / pipeline id and not the name of the item. This means that the metadata in Dev and Prod will be different since the item id is unique between workspaces. As a workaround for this I’m using the Fabric API to lookup fabric items in the current workspace of the pipeline:&amp;nbsp;&lt;A href="https://learn.microsoft.com/en-us/rest/api/fabric/core/items/list-items?tabs=HTTP" target="_blank"&gt;https://learn.microsoft.com/en-us/rest/api/fabric/core/items/list-items?tabs=HTTP&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Outside the ForEach I have one lookup “Get Job Objects” which lists which objects (notebooks or pipelines to run).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also do an API lookup to the Fabric API. To get all items in the workspace (there is no way to query based on an item name in the API, you get everything for a specific item type).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I then would like to use the filter activity to use the name for the specific item I’m looping (item().object_name) to filter the item list from the API to get which ID to use for paramterization of the execute pipeline (or notebook) activity.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Oct 2024 08:19:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Limitation-of-filter-activity-in-foreach-loop/m-p/4234872#M5838</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-10-09T08:19:55Z</dc:date>
    </item>
    <item>
      <title>Re: Limitation of filter activity in foreach loop</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Limitation-of-filter-activity-in-foreach-loop/m-p/4234881#M5839</link>
      <description>&lt;P&gt;In Azure data factory variables are global - meaning you cannot use them inside for loops running in parallell:&amp;nbsp;&lt;A href="https://learn.microsoft.com/en-us/azure/data-factory/control-flow-for-each-activity#limitations-and-workarounds" target="_blank"&gt;https://learn.microsoft.com/en-us/azure/data-factory/control-flow-for-each-activity#limitations-and-workarounds&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is Variables in Microsoft Fabric Data factory pipelines different than ADF?&amp;nbsp;Because I need my ForEach to run in parallell... Documentation for Fabric data factory is a lot more limited than Azure data factory:&amp;nbsp;&lt;A href="https://learn.microsoft.com/en-us/fabric/data-factory/foreach-activity" target="_blank"&gt;https://learn.microsoft.com/en-us/fabric/data-factory/foreach-activity&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Oct 2024 08:26:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Limitation-of-filter-activity-in-foreach-loop/m-p/4234881#M5839</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-10-09T08:26:50Z</dc:date>
    </item>
    <item>
      <title>Re: Limitation of filter activity in foreach loop</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Limitation-of-filter-activity-in-foreach-loop/m-p/4253101#M6011</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to do exactly what you are saying here, and hitting the same issue. I have an array of notebook names to call, and a ForEach loop that iterates and executes a Notebook task, but that task needs the ID of the notebook, not the name of the notebook. So I get a list of notebook names and their IDs in a different call.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have two questions:&lt;/P&gt;&lt;P&gt;1. Did you figure out a workaround to filter the collection of notebook metadata using the ForEach item?&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. I've been using a Fabric notebook to retrieve the list of notebooks and their IDs rather than a Web call (to the REST API I presume).&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import sempy.fabric as fabric
import pandas as pd

items = [fabric.list_items(workspace=ws).query('Type=="Notebook"') for ws in fabric.list_workspaces().query('`Is On Dedicated Capacity` == True').Id]

jsItems = items[0].to_json(orient="records")

mssparkutils.notebook.exit(jsItems)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;I am betting that your Web call to the REST API is much faster but I was lazy - can you share your Web code?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Oct 2024 20:46:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Limitation-of-filter-activity-in-foreach-loop/m-p/4253101#M6011</guid>
      <dc:creator>xhead</dc:creator>
      <dc:date>2024-10-22T20:46:11Z</dc:date>
    </item>
    <item>
      <title>Re: Limitation of filter activity in foreach loop</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Limitation-of-filter-activity-in-foreach-loop/m-p/4253641#M6017</link>
      <description>&lt;P&gt;1) No proper solution but you can work around it by instead of executing a notebook directly, invoke a child pipeline with two pipeline object parameters:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;list_api_items -&amp;gt; input the whole web-call body: &lt;EM&gt;@activity('List items').output.value&lt;/EM&gt;&lt;BR /&gt;for_loop_item -&amp;gt; input @i&lt;EM&gt;tem()&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the child pipeline you can then filter the list_api_items parameter as you would do normally.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, we use a metadata driven orchestration framework. What we ended up doing is that we created a separate pipeline named "GetFabricItems". When we run that pipeline we retrive all items and their object id's for the current workspace and insert them into a database table. When we then retrive the lookup "Get Job Objects" (as shown in my screenshot in previous post) we will get the pipeline name and the pipeline id etc. Seems to be working well so far. We just need to make sure that we populate the fabric item table in our framework database before running any pipelines.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2) The API-call is:&lt;/P&gt;&lt;P&gt;For all items: &lt;A href="https://api.fabric.microsoft.com/v1/workspaces/@{pipeline().DataFactory}/items" target="_blank"&gt;https://api.fabric.microsoft.com/v1/workspaces/@{pipeline().DataFactory}/items&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For specific type of items: &lt;A href="https://api.fabric.microsoft.com/v1/workspaces/@{pipeline().DataFactory}/warehouses/" target="_blank"&gt;https://api.fabric.microsoft.com/v1/workspaces/@{pipeline().DataFactory}/warehouses/&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;&lt;A href="https://api.fabric.microsoft.com/v1/workspaces/@{pipeline().DataFactory}/notebooks/" target="_blank"&gt;https://api.fabric.microsoft.com/v1/workspaces/@{pipeline().DataFactory}/notebooks/&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With the specific api-calls you get som additional information based on the type. For example you get connection string for warehouses.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Documentation is here: &lt;A href="https://learn.microsoft.com/en-us/rest/api/fabric/core/items/get-item?tabs=HTTP" target="_blank"&gt;https://learn.microsoft.com/en-us/rest/api/fabric/core/items/get-item?tabs=HTTP&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2024 06:25:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Limitation-of-filter-activity-in-foreach-loop/m-p/4253641#M6017</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-10-23T06:25:34Z</dc:date>
    </item>
    <item>
      <title>Re: Limitation of filter activity in foreach loop</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Limitation-of-filter-activity-in-foreach-loop/m-p/4620445#M7328</link>
      <description>&lt;P&gt;News about this topic?&lt;/P&gt;</description>
      <pubDate>Fri, 21 Mar 2025 21:54:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Limitation-of-filter-activity-in-foreach-loop/m-p/4620445#M7328</guid>
      <dc:creator>pquispe</dc:creator>
      <dc:date>2025-03-21T21:54:30Z</dc:date>
    </item>
  </channel>
</rss>

