<?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>Question Re: Multi-table Formula in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/multi-table-formula/qaa-p/12755923#M4788147</link>
    <description>&lt;P&gt;You should avoid using If statements in the Select Expert - most of the time they can't be pushed to the database for processing so Crystal will pull all of the data into memory and filter it there, causing significant slowness in the report.  Also, you're not linking together your filter criteria with and/or, which is probably what's causing your issues.&lt;/P&gt;&lt;P&gt;Try something like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;(
  (
    {?Department} = 'Sales' and  
	Date({EDI_RPT_VHMLS.DateInvoice}) &amp;gt;= {?Start Date} and
	Date({EDI_RPT_VHMLS.DateInvoice}) &amp;lt;= {?End Date}
  } OR
  Date(EDI_RPT_VHMLS.DateInvoice})) &amp;gt; CurrentDate + 10000
)
AND
(
   (
      {?Department} = 'Service' and
	  Date({SVSLS.DateInvoice}) &amp;gt;= {?Start Date} and
	  Date({SVSLS.DateInvoice}) &amp;lt;= {?End Date}
   ) OR
   Date({SVSLS.DateInvoice}) &amp;gt;= CurrentDate + 10000
)
AND
(
   (
      {?Department} = 'Parts' and
	  Date({PTSLS.DateInvoice}) &amp;gt;= {?Start Date} and
	  Date({PTSLS.DateInvoice}) &amp;lt;= {?End Date}
   ) OR
   Date({PTSLS.DateInvoice}) &amp;gt;= CurrentDate + 10000
)
AND
(
   (
      {?Department} = 'Rentals' and
	  Date({LRBIL.DateInvoice}) &amp;gt;= {?Start Date} and
	  Date({LRBIL.DateInvoice}) &amp;lt;= {?End Date}
   ) OR
   Date({LRBIL.DateInvoice}) &amp;gt;= CurrentDate + 10000
)
&lt;/CODE&gt;&lt;/PRE&gt;-Dell</description>
    <pubDate>Wed, 02 Aug 2023 16:05:07 GMT</pubDate>
    <dc:creator>DellSC</dc:creator>
    <dc:date>2023-08-02T16:05:07Z</dc:date>
    <item>
      <title>Multi-table Formula</title>
      <link>https://community.sap.com/t5/technology-q-a/multi-table-formula/qaq-p/12755922</link>
      <description>&lt;P&gt;Good Morning,&lt;/P&gt;
  &lt;P&gt;This report uses five tables. One table is the Customer table and the others are transactions for each department. The tables are linked on the Customer ID field.&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2196595-1-1.png" /&gt;&lt;/P&gt;
  &lt;P&gt;There is also a Parameter that allows the user to select a Department. The departments are Sales, Service, Parts, or Rentals.&lt;/P&gt;
  &lt;P&gt;I then created a straight forward formula that selects the Sub-total amount from the appropriate table based on the value of the parameter.&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2196596-1-2.png" /&gt;&lt;/P&gt;
  &lt;P&gt;...and a record selection formula, also based on the value of the parameter, which excludes records from the other tables by adding 10,000 days to the current date and specifying that only invoice dates greater than that should be included (which of course there are none).&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2196599-1-5.png" /&gt;&lt;/P&gt;
  &lt;P&gt;The problem is that the record selection formula produces erroneous results, including values from other departments as if the IF statement did not exist. For example; if I remove the other conditions from the record selection formula, the results appear to be accurate.&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2196600-1-6.png" /&gt;&lt;/P&gt;
  &lt;P&gt;All of the grouping and group sorting for this report seem fine. Can someone please tell me why my record selection formula is failing?&lt;/P&gt;
  &lt;P&gt;Thanks - Tom&lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2023 14:26:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/multi-table-formula/qaq-p/12755922</guid>
      <dc:creator>former_member1343181</dc:creator>
      <dc:date>2023-08-02T14:26:51Z</dc:date>
    </item>
    <item>
      <title>Re: Multi-table Formula</title>
      <link>https://community.sap.com/t5/technology-q-a/multi-table-formula/qaa-p/12755923#M4788147</link>
      <description>&lt;P&gt;You should avoid using If statements in the Select Expert - most of the time they can't be pushed to the database for processing so Crystal will pull all of the data into memory and filter it there, causing significant slowness in the report.  Also, you're not linking together your filter criteria with and/or, which is probably what's causing your issues.&lt;/P&gt;&lt;P&gt;Try something like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;(
  (
    {?Department} = 'Sales' and  
	Date({EDI_RPT_VHMLS.DateInvoice}) &amp;gt;= {?Start Date} and
	Date({EDI_RPT_VHMLS.DateInvoice}) &amp;lt;= {?End Date}
  } OR
  Date(EDI_RPT_VHMLS.DateInvoice})) &amp;gt; CurrentDate + 10000
)
AND
(
   (
      {?Department} = 'Service' and
	  Date({SVSLS.DateInvoice}) &amp;gt;= {?Start Date} and
	  Date({SVSLS.DateInvoice}) &amp;lt;= {?End Date}
   ) OR
   Date({SVSLS.DateInvoice}) &amp;gt;= CurrentDate + 10000
)
AND
(
   (
      {?Department} = 'Parts' and
	  Date({PTSLS.DateInvoice}) &amp;gt;= {?Start Date} and
	  Date({PTSLS.DateInvoice}) &amp;lt;= {?End Date}
   ) OR
   Date({PTSLS.DateInvoice}) &amp;gt;= CurrentDate + 10000
)
AND
(
   (
      {?Department} = 'Rentals' and
	  Date({LRBIL.DateInvoice}) &amp;gt;= {?Start Date} and
	  Date({LRBIL.DateInvoice}) &amp;lt;= {?End Date}
   ) OR
   Date({LRBIL.DateInvoice}) &amp;gt;= CurrentDate + 10000
)
&lt;/CODE&gt;&lt;/PRE&gt;-Dell</description>
      <pubDate>Wed, 02 Aug 2023 16:05:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/multi-table-formula/qaa-p/12755923#M4788147</guid>
      <dc:creator>DellSC</dc:creator>
      <dc:date>2023-08-02T16:05:07Z</dc:date>
    </item>
  </channel>
</rss>

