CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2014
    Posts
    6

    Need help to create Crystal Report

    Hi all,

    I am trying to find a better way to develop a report in Crystal Report from excel spreadsheets. I have about 4 different spreadsheets (Dallas, New York, San Francisco and Los Angeles) from one same datasource.

    Here is the layout:
    Name:  layout.PNG
Views: 481
Size:  9.1 KB

    So, Dallas, New York, San Francisco and Los Angeles cities are in the same datasource but each city has different Country, State and City code. The value on each cell on each City are from one dataset called "person".

    - The value 12,10 and 15 in Dallas city has to pass these code requirements. Country code: 12, State Code: 22, City Code: 32
    - The value 11,0 and 14 in New York city has to pass these code requirements. Country code: 10, State Code: 20, City Code: 40
    -and so on.

    So, my question is, what is a better way to develop a report like this format in Crystal Report? Subreport?

    If I have to do the report with subreport, then I would have 4 subreports for each city but how can I total each city and have them on the same main report (see gray Total area)?

    Thank you all
    Last edited by NewCrystalGirl; February 23rd, 2015 at 09:53 PM.

  2. #2
    Join Date
    Feb 2015
    Posts
    11

    Re: Need help to create Crystal Report

    No Subreport needed. You can accomplish the above look using a cross-table. Youtube Crystal Reports Cross-table for step-by-step instructions. You can filter out the states in a cross-table.
    From my understanding, the displayed Dallas column is only in reference to Country code: 12, State Code: 22, City Code: 32. Are the Country code, State Code, and City Code fields?
    Create a formula with the below logic

    If [Country Code] = 12 and [State Code] = 22 and City Code = 32 then "Dallas" else
    If [Country Code] = 10 and [State Code] = 20 and City Code = 40 then "New York"

    and so on...

    Use the created formula in the cross-table. You should obtain your desired results. Use 3 fields in the cross-table, Row= [job] Column= [person] and [created formula]. sum by [created formula]. set cross table to only display one total amount.

    By default, your cross-table will display all persons.
    If your goal is only to display amount for a specific person, then specify the person in [person] field with the cross table options, and exclude other results. You can copy the cross-table and paste it on the report to get your above look for each person.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured