Results 1 to 3 of 3

Thread: Data Designer: Unable to group (newbie question)

  1. #1

    Thread Starter
    Hyperactive Member Petergotchi's Avatar
    Join Date
    Jan 2002
    Location
    Dendermonde - Belgium
    Posts
    267

    Data Designer: Unable to group (newbie question)

    Hi,

    I'm new to building reports. I've gotten to a point where I want to group the results, but can't seem to figure out how it works. I've spent 2 hours searching on this and can't seem to get it to work.

    This is what I got so far:

    I've read that I need to use Shape. So I altered my SQL command to the following:
    Code:
    "SHAPE{SELECT UserName,LogInDate,LogInTime,LogOutDate,LogOutTime FROM " & strTable & " WHERE LogInDate BETWEEN #" & strFromDate & "# AND #" & strToDate & "# ORDER BY [UserName]}" & "AS SQL1 COMPUTE SQL1 BY UserName"
    And defined the fields in my code like that:
    Code:
        DataReport1.Sections("section1").Controls.Item("Text1").DataField = "LogInDate"
        DataReport1.Sections("section1").Controls.Item("Text1").DataMember = "SQL1"
        DataReport1.Sections("section1").Controls.Item("Text2").DataField = "LogInTime"
        DataReport1.Sections("section1").Controls.Item("Text2").DataMember = "SQL1"
        DataReport1.Sections("section1").Controls.Item("Text3").DataField = "LogOutDate"
        DataReport1.Sections("section1").Controls.Item("Text3").DataMember = "SQL1"
        DataReport1.Sections("section1").Controls.Item("Text4").DataField = "LogOutTime"
        DataReport1.Sections("section1").Controls.Item("Text4").DataMember = "SQL1"
        DataReport1.Sections("section1").Controls.Item("Text5").DataField = "UserName"
        DataReport1.Sections("section1").Controls.Item("Text5").DataMember = "SQL1"
    This generates the following report:
    Code:
    Username:       Login Date:    Login Time:       Logout Date:   Logout Time:
    
    User             5/02/2008      13:30:00           5/02/2008     16:00:00
    User             5/02/2008      7:00:00            5/02/2008     12:00:00
    User             2/02/2008      9:00:00            2/02/2008     17:00:00
    User2            4/02/2008      10:00:00           4/02/2008     18:00:00
    User3            3/02/2008      8:30:00            3/02/2008     16:30:00
    But what I really want is to group the times per username. How can I do this? Thanks for your guidance.

    PS: I'm using the classic VB6
    Kind Regards,

    Pieter

    PS: If you found someone's answer helpful, please be so kind to rate that person.
    Thanks.

  2. #2
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: Data Designer: Unable to group (newbie question)

    Right-Click in any section within the data report and select the Insert Group Header/Footer menu item.
    Add a TextBox control into the new Group Section and set it's DataField property to UserName. It's DataMember property must be left empty.

  3. #3

    Thread Starter
    Hyperactive Member Petergotchi's Avatar
    Join Date
    Jan 2002
    Location
    Dendermonde - Belgium
    Posts
    267

    Re: Data Designer: Unable to group (newbie question)

    Hi,

    Great! Worked like a charm. I already had a group header in but it wouldn't work because I didn't leave the datamember field empty!
    Thanks m8! Can't believe I was struggling with this for so long... :-)
    Kind Regards,

    Pieter

    PS: If you found someone's answer helpful, please be so kind to rate that person.
    Thanks.

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