• Create an expression smart field with the following code:


      (Select DATEPART(year,[RE_EXPRESS_3GIFTS].[DATE]))

      This will get the year of the gift. Target table is Gift. Name the smart field Year.



    • Create another expression smart field that does a distinct count of the values of the smart field created in step 1:


      (SELECT DISTINCT COUNT([RE_EXPRESS_3GIFTS].[Year]) FROM [RE_EXPRESS_3GIFTS] WHERE [RE_EXPRESS_3GIFTS].[BIZINTEL_PARENTID] = [RE_EXPRESS_3CONSTITUENT].[BIZINTEL_ID] and [RE_EXPRESS_3GIFTS].[DATE] > DATEADD(year,-10,GETDATE()))



      Disclaimer: We provide programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes you are familiar with Structured Query Language and the tools used to create and modify SQL statements and Crystal Reports. Our Customer Support may help explain the functionality of a particular procedure, but we will not modify, or assist you with modifying, these examples to provide additional functionality.