<?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: How to use count in Warehouse Table in IF Condition in pipeline in Pipelines</title>
    <link>https://community.fabric.microsoft.com/t5/Pipelines/How-to-use-count-in-Warehouse-Table-in-IF-Condition-in-pipeline/m-p/3887951#M3064</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="645442" data-lia-user-login="JE_test" class="lia-mention lia-mention-user"&gt;JE_test&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;As part of debugging, can you please use a Set Variable and try to see the output of it?&lt;BR /&gt;When I tried to repro, it is working perfectly. I can go to true and false branches.&lt;/P&gt;</description>
    <pubDate>Fri, 03 May 2024 06:15:19 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-05-03T06:15:19Z</dc:date>
    <item>
      <title>How to use count in Warehouse Table in IF Condition in pipeline</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/How-to-use-count-in-Warehouse-Table-in-IF-Condition-in-pipeline/m-p/3886529#M3046</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to create an If condition in a pipeline that should be true if a table in my DW has more than 0 rows.&lt;/P&gt;&lt;P&gt;I don't know how to query this table from the IF Condition.&lt;/P&gt;&lt;P&gt;I tried to use a lookup before to query the table (count(*) as nr_of_rows from ...) but then I don't know how to access the value nr_of_rows when writing the expression in the if statement. I tried some different variations but nothing seems to work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The condition in my if is of the form:&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;@&lt;/SPAN&gt;&lt;SPAN&gt;if(not(equals(activity(&lt;/SPAN&gt;&lt;SPAN&gt;'Lookup1'&lt;/SPAN&gt;&lt;SPAN&gt;).&lt;/SPAN&gt;&lt;SPAN&gt;output&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;firstRow&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;'0'&lt;/SPAN&gt;&lt;SPAN&gt;)), &lt;/SPAN&gt;&lt;SPAN&gt;true&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;false&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;and I've tried some variations of this, but never getting the value from&amp;nbsp;nr_of_rows (nr of rows in my WH-table)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;Ideally I would like to not use a Lookup and only do a query in the expression of the IF condition.&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Any ideas on how to solve this?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 02 May 2024 15:02:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/How-to-use-count-in-Warehouse-Table-in-IF-Condition-in-pipeline/m-p/3886529#M3046</guid>
      <dc:creator>JE_test</dc:creator>
      <dc:date>2024-05-02T15:02:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to use count in Warehouse Table in IF Condition in pipeline</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/How-to-use-count-in-Warehouse-Table-in-IF-Condition-in-pipeline/m-p/3887695#M3057</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="645442" data-lia-user-login="JE_test" class="lia-mention lia-mention-user"&gt;JE_test&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;Thanks for using Fabric Community.&lt;BR /&gt;As I understand you would like to perform if else operation based on value of count.&lt;BR /&gt;&lt;BR /&gt;Steps to achieve it -&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;select count(*) as count from api.table4&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;@not(equals(activity('Lookup1').output.firstRow.count, '0'))
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;FYI: inorder to understand the loopup activity json output,&lt;BR /&gt;After execution of pipeline, you find the below -&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Hope this is helpful. Please let me know incase of further queries.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2024 03:39:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/How-to-use-count-in-Warehouse-Table-in-IF-Condition-in-pipeline/m-p/3887695#M3057</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-05-03T03:39:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to use count in Warehouse Table in IF Condition in pipeline</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/How-to-use-count-in-Warehouse-Table-in-IF-Condition-in-pipeline/m-p/3887868#M3062</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;Thanks for the suggestion. My setup was close to what you describe, but now I think it is the same:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Lookup:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;SELECT COUNT(*) as antal_tasks FROM [meta].[ScheduledTasks]&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;IF:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;@&lt;/SPAN&gt;&lt;SPAN&gt;not(equals(activity(&lt;/SPAN&gt;&lt;SPAN&gt;'Lookup1'&lt;/SPAN&gt;&lt;SPAN&gt;).&lt;/SPAN&gt;&lt;SPAN&gt;output&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;firstRow&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;antal_tasks&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;'0'&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;But my issue is that the IF statement still goes into the TRUE case. Not sure why.&amp;nbsp; And I just double checked that the table I'm querying indeed has 0 rows.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;img /&gt;&lt;P&gt;Are we sure that we are accessing the number from the lookup and no other part of the string or something, which would make the output not exactly equal to 0?&lt;/P&gt;&lt;img /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 03 May 2024 05:43:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/How-to-use-count-in-Warehouse-Table-in-IF-Condition-in-pipeline/m-p/3887868#M3062</guid>
      <dc:creator>JE_test</dc:creator>
      <dc:date>2024-05-03T05:43:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to use count in Warehouse Table in IF Condition in pipeline</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/How-to-use-count-in-Warehouse-Table-in-IF-Condition-in-pipeline/m-p/3887951#M3064</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="645442" data-lia-user-login="JE_test" class="lia-mention lia-mention-user"&gt;JE_test&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;As part of debugging, can you please use a Set Variable and try to see the output of it?&lt;BR /&gt;When I tried to repro, it is working perfectly. I can go to true and false branches.&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2024 06:15:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/How-to-use-count-in-Warehouse-Table-in-IF-Condition-in-pipeline/m-p/3887951#M3064</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-05-03T06:15:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to use count in Warehouse Table in IF Condition in pipeline</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/How-to-use-count-in-Warehouse-Table-in-IF-Condition-in-pipeline/m-p/3888206#M3065</link>
      <description>&lt;P&gt;Thanks for the tips with using Set Variable for debugging!&lt;/P&gt;&lt;P&gt;Maybe the problem was that it was comparing an integer to a string and found it to be false. When I try to&amp;nbsp; assign the output to a String I get this error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The variable 'output' of type 'String' cannot be initialized or updated with value of type 'Integer'. The variable 'output' only supports values of types 'String'.&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2024 07:40:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/How-to-use-count-in-Warehouse-Table-in-IF-Condition-in-pipeline/m-p/3888206#M3065</guid>
      <dc:creator>JE_test</dc:creator>
      <dc:date>2024-05-03T07:40:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to use count in Warehouse Table in IF Condition in pipeline</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/How-to-use-count-in-Warehouse-Table-in-IF-Condition-in-pipeline/m-p/3888228#M3066</link>
      <description>&lt;P&gt;Yes that was it. I removed the quotes from the 0 and not it works as expected:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;@&lt;/SPAN&gt;&lt;SPAN&gt;not(equals(activity(&lt;/SPAN&gt;&lt;SPAN&gt;'Lookup1'&lt;/SPAN&gt;&lt;SPAN&gt;).&lt;/SPAN&gt;&lt;SPAN&gt;output&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;firstRow&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;antal_tasks&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;instead of&amp;nbsp;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;@&lt;/SPAN&gt;&lt;SPAN&gt;not(equals(activity(&lt;/SPAN&gt;&lt;SPAN&gt;'Lookup1'&lt;/SPAN&gt;&lt;SPAN&gt;).&lt;/SPAN&gt;&lt;SPAN&gt;output&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;firstRow&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;antal_tasks&lt;/SPAN&gt;&lt;SPAN&gt;, '&lt;/SPAN&gt;&lt;SPAN&gt;0'&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 03 May 2024 07:44:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/How-to-use-count-in-Warehouse-Table-in-IF-Condition-in-pipeline/m-p/3888228#M3066</guid>
      <dc:creator>JE_test</dc:creator>
      <dc:date>2024-05-03T07:44:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to use count in Warehouse Table in IF Condition in pipeline</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/How-to-use-count-in-Warehouse-Table-in-IF-Condition-in-pipeline/m-p/3888233#M3068</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="645442" data-lia-user-login="JE_test" class="lia-mention lia-mention-user"&gt;JE_test&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;It was great to know that you were able to get to a resolution . We expect you to keep using this forum and also motivate others to do that same . You can always help other community members by answering to their queries&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2024 07:45:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/How-to-use-count-in-Warehouse-Table-in-IF-Condition-in-pipeline/m-p/3888233#M3068</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-05-03T07:45:45Z</dc:date>
    </item>
  </channel>
</rss>

