<?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: ABAP CDS w/#COUNT_DISTINCT Problems (Null or # Value) in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-cds-w-count-distinct-problems-null-or-value/m-p/12712352#M2019246</link>
    <description>&lt;P&gt;Thanks for the follow-up...   !!!&lt;/P&gt;&lt;P&gt;I did try all the different ways like '#', '', null etc.   &lt;/P&gt;&lt;P&gt;It totally looks like the CASE has no affect on the #COUNT_DISTINCT annotation uggg.&lt;/P&gt;&lt;P&gt;I'm still working on this so if you or anyone has any ideas how to accomplish this it would be greatly helpful!&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Ultimately the solution should have the #COUNT_DISTINCT ignore null values or somehow decrement 1 from the final count if any null values are in the list.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Thanks for any input!  &lt;/P&gt;</description>
    <pubDate>Fri, 03 Feb 2023 15:52:11 GMT</pubDate>
    <dc:creator>sap_cohort</dc:creator>
    <dc:date>2023-02-03T15:52:11Z</dc:date>
    <item>
      <title>ABAP CDS w/#COUNT_DISTINCT Problems (Null or # Value)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-cds-w-count-distinct-problems-null-or-value/m-p/12712347#M2019241</link>
      <description>&lt;P&gt;I have an ABAP CDS View field value defined as follows:&lt;BR /&gt;The field definition is in an ABAP CDS Consumption View with Data Category #CUBE&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;@EndUserText.label: 'Related Link Count'&lt;BR /&gt;@Aggregation.default: #COUNT_DISTINCT&lt;BR /&gt;@Aggregation.referenceElement: ['RelatedLinkID']&lt;BR /&gt;cast(1 as abap.int4) as RelatedLinkCount, &lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;&lt;STRONG&gt;The &lt;/STRONG&gt;&lt;STRONG&gt;CDS Query referencing this #CUBE field is returning a value of 11. I should only get 10. &lt;/STRONG&gt;&lt;BR /&gt;The plus one is because some of the lines have a field value of '#'. &lt;BR /&gt;The '#' is getting is being picked up as one of the distinct values&lt;BR /&gt;I'm not sure if in ABAP CDS if '#' really means NULL or Initial Value. I see the '#' in RSRT results.&lt;BR /&gt;I am thinking the '#' means NULL because the '#' value is generated from a CASE Statement without an ELSE. &lt;BR /&gt;Or does the null value '#' from the CASE result get interpreted to an ABAP INITIAL Value and just shows '#'?&lt;BR /&gt;The reason I want a null value is supposedly #COUNT_DISTINCT does not consider NULL Values but this does not seem to be the case for ABAP CDS. There are not any good examples of #COUNT_DISTINCT.&lt;BR /&gt;I'm sure ABAP CDS #COUNT_DISTINCT works fine if there are no null values.&lt;BR /&gt;&lt;BR /&gt;Questions:&lt;BR /&gt;&lt;STRONG&gt;Is there a way to force a ABAP CDS field value to NULL?&lt;BR /&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;STRONG&gt;Is #COUNT_DISTINCT in ABAP CDS really supposed to ignore NULL Values or is it just not working? &lt;/STRONG&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;STRONG&gt;How could I have my field #COUNT_DISTINCT Annotations ignore the '#' values? (Not include # in my count)&lt;BR /&gt;(Should the solution be in the CDS Query instead?)&lt;/STRONG&gt;&lt;/P&gt;
  &lt;P&gt;&lt;BR /&gt;Thanks for any support on this! &lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2023 02:55:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-cds-w-count-distinct-problems-null-or-value/m-p/12712347#M2019241</guid>
      <dc:creator>sap_cohort</dc:creator>
      <dc:date>2023-02-02T02:55:42Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP CDS w/#COUNT_DISTINCT Problems (Null or # Value)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-cds-w-count-distinct-problems-null-or-value/m-p/12712348#M2019242</link>
      <description>&lt;P&gt;NULL is a distinct value, so it is counted on COUNT_DISTINCT&lt;/P&gt;&lt;P&gt;What about a case statement?&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;cast(
case when Postcode is initial then 0
      else 1
      end as abap.int4)          as RelatedLinkCount,&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 02 Feb 2023 06:55:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-cds-w-count-distinct-problems-null-or-value/m-p/12712348#M2019242</guid>
      <dc:creator>Marian_Zeis</dc:creator>
      <dc:date>2023-02-02T06:55:31Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP CDS w/#COUNT_DISTINCT Problems (Null or # Value)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-cds-w-count-distinct-problems-null-or-value/m-p/12712349#M2019243</link>
      <description>&lt;P&gt;Hi Marian, Thanks for your input and suggestion.  &lt;/P&gt;&lt;P&gt;It seems that the case statement has no effect to exclude the "#".  &lt;BR /&gt;Any other thoughts or suggestions!  Could really use this count to exclude "#" somehow.  &lt;BR /&gt;&lt;BR /&gt;Anyone know what we could do to exclude the "#" value from #COUNT_DISTINCT in ABAP CDS? &lt;BR /&gt;&lt;BR /&gt;Greatly appreciated! &lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2023 18:57:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-cds-w-count-distinct-problems-null-or-value/m-p/12712349#M2019243</guid>
      <dc:creator>sap_cohort</dc:creator>
      <dc:date>2023-02-02T18:57:48Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP CDS w/#COUNT_DISTINCT Problems (Null or # Value)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-cds-w-count-distinct-problems-null-or-value/m-p/12712350#M2019244</link>
      <description>&lt;P&gt;Hi  &lt;SPAN class="mention-scrubbed"&gt;kenneth.murray2&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;i don´t know, if its a actually "'#", maybe try:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;cast(
case when Postcode is initial then 0&lt;BR /&gt;     when Postcode = '#' then 0
      else 1
      end as abap.int4)          as RelatedLinkCount,&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 Feb 2023 06:50:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-cds-w-count-distinct-problems-null-or-value/m-p/12712350#M2019244</guid>
      <dc:creator>Marian_Zeis</dc:creator>
      <dc:date>2023-02-03T06:50:13Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP CDS w/#COUNT_DISTINCT Problems (Null or # Value)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-cds-w-count-distinct-problems-null-or-value/m-p/12712351#M2019245</link>
      <description>&lt;P&gt;Hi Team Community, Does anyone have any other thoughts on how we could acheive this result?&lt;/P&gt;&lt;P&gt;Basically looking for a way to use #COUNT_DISTINCT but, exclude a specific value (Null or any other value) &lt;BR /&gt;Thank You!&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2023 14:14:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-cds-w-count-distinct-problems-null-or-value/m-p/12712351#M2019245</guid>
      <dc:creator>sap_cohort</dc:creator>
      <dc:date>2023-02-03T14:14:50Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP CDS w/#COUNT_DISTINCT Problems (Null or # Value)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-cds-w-count-distinct-problems-null-or-value/m-p/12712352#M2019246</link>
      <description>&lt;P&gt;Thanks for the follow-up...   !!!&lt;/P&gt;&lt;P&gt;I did try all the different ways like '#', '', null etc.   &lt;/P&gt;&lt;P&gt;It totally looks like the CASE has no affect on the #COUNT_DISTINCT annotation uggg.&lt;/P&gt;&lt;P&gt;I'm still working on this so if you or anyone has any ideas how to accomplish this it would be greatly helpful!&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Ultimately the solution should have the #COUNT_DISTINCT ignore null values or somehow decrement 1 from the final count if any null values are in the list.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Thanks for any input!  &lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2023 15:52:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-cds-w-count-distinct-problems-null-or-value/m-p/12712352#M2019246</guid>
      <dc:creator>sap_cohort</dc:creator>
      <dc:date>2023-02-03T15:52:11Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP CDS w/#COUNT_DISTINCT Problems (Null or # Value)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-cds-w-count-distinct-problems-null-or-value/m-p/12712353#M2019247</link>
      <description>&lt;P&gt;Wanted to close this out.  &lt;/P&gt;&lt;P&gt;Solution was to have a separate indicator field if any of the RelatedLinkID was null.  &lt;BR /&gt;This indicator could be used further down the road to subtract 1 from the count.  Hope that helps somone.&lt;/P&gt;</description>
      <pubDate>Wed, 24 May 2023 21:08:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-cds-w-count-distinct-problems-null-or-value/m-p/12712353#M2019247</guid>
      <dc:creator>sap_cohort</dc:creator>
      <dc:date>2023-05-24T21:08:48Z</dc:date>
    </item>
  </channel>
</rss>

