Find it EZ

Location: Local or Network Folders
Host: FINDITEZ-T460P
Path: C:\Users\ken\Documents\Test Cases\SSRS\Group By Intervals.rdl

Report Information
    Description    Report Title: How to group data in intervals
                   Report Author: Copyright © 2004 Business Objects
                   Converted By: Crystal Migration Services, support@crystalmigrater.com

Data Sources

    DataSource1
        Name    DataSource1
        Connection String    DSN=Xtreme Sample Database 11.5;
        Data Provider    ODBC

Datasets

    DataSet1
        Name    DataSet1

        Query
            Data Source    DataSource1
            CommandText    
                           SELECT Customer.[Last Year's Sales], Customer.[Customer Name], Customer.Region, Customer.[Postal Code], Customer.Country 
                           FROM   Customer Customer 
                           ORDER BY Customer.[Customer Name]

            Parameters

        Fields

            Last_Year_s_Sales
                Name    Last_Year_s_Sales
                Source    [Last Year's Sales]
                Data Type    Decimal

            Customer_Name
                Name    Customer_Name
                Source    [Customer Name]
                Data Type    String

            Region
                Name    Region
                Source    Region
                Data Type    String

            Postal_Code
                Name    Postal_Code
                Source    [Postal Code]
                Data Type    String

            Country
                Name    Country
                Source    Country
                Data Type    String

Embedded Images

    Picture_A2D8E55F449BDCA6DA69F73BB67F1020
        Name    Picture_A2D8E55F449BDCA6DA69F73BB67F1020
        Type    jpeg

    Picture_A71C16DB5FC6FA97CA22693727225E5E
        Name    Picture_A71C16DB5FC6FA97CA22693727225E5E
        Type    jpeg

Custom Code
        
        Public Function Group_1_Order (ByVal dbField0 As Decimal) As String
                 If IsNothing(dbField0) Then 
                Return Nothing
             ElseIf dbField0 < 10000.00 Then 
                Return "Less than $10,000"
             ElseIf (dbField0 >= 10000.00 And dbField0 <= 25000.00) Then 
                Return "$10,000 to $25,000"
             ElseIf dbField0 > 25000.00 Then 
                Return "Over $25,000"
             Else 
                Return "Others"
             End If 
        End Function
        
        Public Function SortGroup_1_Order (ByVal dbField0 As Decimal) As Decimal
                 If IsNothing(dbField0) Then 
                Return 0
             ElseIf dbField0 < 10000.00 Then 
                Return (-4)
             ElseIf (dbField0 >= 10000.00 And dbField0 <= 25000.00) Then 
                Return (-3)
             ElseIf dbField0 > 25000.00 Then 
                Return (-2)
             Else 
                Return 0
             End If 
        End Function
        
        

Page Header

    Report Items

        Text2
            Name    Text2
            Type    Text Box
            Content    Customer Name

        Text3
            Name    Text3
            Type    Text Box
            Content    Region

        Text4
            Name    Text4
            Type    Text Box
            Content    Country

        Text5
            Name    Text5
            Type    Text Box
            Content    Last Year's Sales

        Text6
            Name    Text6
            Type    Text Box
            Content    How to group data in intervals

        Text7
            Name    Text7
            Type    Text Box
            Content    Postal Code

Body

    Report Items

        Text1
            Name    Text1
            Type    Text Box
            Content    Group Data in Intervals

        Field1
            Name    Field1
            Type    Text Box
            Content    =Format(Globals.ExecutionTime, "M/d/yyyy")

        Field2
            Name    Field2
            Type    Text Box
            Content    =Format(Globals.ExecutionTime, "h:m:s tt")

        Picture4
            Name    Picture4
            Type    Image
            Source Type    Embedded Image Name
            Embedded Image Name    Picture_A71C16DB5FC6FA97CA22693727225E5E

        Text2_1
            Name    Text2_1
            Type    Text Box
            Content    Customer Name

        Text3_1
            Name    Text3_1
            Type    Text Box
            Content    Region

        Text4_1
            Name    Text4_1
            Type    Text Box
            Content    Country

        Text5_1
            Name    Text5_1
            Type    Text Box
            Content    Last Year's Sales

        Text6_1
            Name    Text6_1
            Type    Text Box
            Content    How to group data in intervals

        Text7_1
            Name    Text7_1
            Type    Text Box
            Content    Postal Code

        RectArea3
            Name    RectArea3
            Type    Rectangle

        Field3
            Name    Field3
            Type    Text Box
            Content    =Code.Group_1_Order (Fields!Last_Year_s_Sales.Value)

        RectArea4
            Name    RectArea4
            Type    Rectangle

        Customer_Name
            Name    Customer_Name
            Type    Text Box
            Content    =Fields!Customer_Name.Value

        Postal_Code
            Name    Postal_Code
            Type    Text Box
            Content    =Fields!Postal_Code.Value

        Country
            Name    Country
            Type    Text Box
            Content    =Fields!Country.Value

        Last_Year_s_Sales
            Name    Last_Year_s_Sales
            Type    Text Box
            Content    =Fields!Last_Year_s_Sales.Value

        Region
            Name    Region
            Type    Text Box
            Content    =Fields!Region.Value

        RectArea5
            Name    RectArea5
            Type    Rectangle

        SummaryField9
            Name    SummaryField9
            Type    Text Box
            Content    =Sum (Fields!Last_Year_s_Sales.Value)

        Text8
            Name    Text8
            Type    Text Box
            Content    Total:

    Data Regions

        Tablix1
            Name    Tablix1
            Type    Table

            Row Member 1

                Group1
                    Name    Group1
                    Expressions    =Code.Group_1_Order (Fields!Last_Year_s_Sales.Value)
                Sort Expressions    =Code.SortGroup_1_Order (Fields!Last_Year_s_Sales.Value)

            Row Member 1

            Row Member 2

                Details
                    Name    Details
                Sort Expressions    =Fields!Customer_Name.Value

            Row Member 3
            Source Dataset    DataSet1

Page Footer

    Report Items

        Field10
            Name    Field10
            Type    Text Box
            Content    =Globals!PageNumber

        Picture2
            Name    Picture2
            Type    Image
            Source Type    Embedded Image Name
            Embedded Image Name    Picture_A2D8E55F449BDCA6DA69F73BB67F1020

            Actions
                Go to URL    http://www.businessobjects.com

        Text9
            Name    Text9
            Type    Text Box
            Content    Business Objects Technical Support Site

            Actions
                Go to URL    http://support.businessobjects.com

        Text10
            Name    Text10
            Type    Text Box
            Content    Copyright 2004 Business Objects Software Limited. All rights reserved. Business Objects, the Business Objects logo, Crystal Reports, Crystal Enterprise, Crystal Analysis, WebIntelligence, RapidMarts, and BusinessQuery are trademarks or registered trademarks of Business Objects and its affiliates in the United States and/or other countries. Other trademarks are the property of their respective owners. Business Objects owns the following U.S. patents, which may cover products that are offered and sold by Business Objects: 5,555,403, 6,247,008 B1, 6,578,027 B2, 6,490,593 and 6,289,352. 

        Text11
            Name    Text11
            Type    Text Box
            Content    Feedback on Samples by E-mail

            Actions
                Go to URL    mailto:crfeedback@businessobjects.com