Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Can you link report records? Post Reply Post New Topic
Author Message
Quirky
Newbie
Newbie
Avatar

Joined: 18 Jun 2012
Location: United Kingdom
Online Status: Offline
Posts: 8
Quote Quirky Replybullet Topic: Can you link report records?
     Posted: 29 Jun 2012 at 3:41am
Hey all :)

Got a dialler table which holds the following info:

Row Number | Agent | Sign In | Sign out

My problem is that they add a new row for each instance, so I have one row with the Sign In date/time and a second row for when they Sign Out.

Row Number | Agent | Sign In | Sign Out
1     | KD    | 29/06/2012 08:15:34 |
2     | PG    | 29/06/2012 08:16:45 |
2     | FS    | 29/06/2012 08:58:54 |
4     | KD    |                     |29/06/2012 10:30:30
5     | FS    |                     |29/06/2012 11:00:12   
6     | KD    | 29/06/2012 11:30:15 |


I'd like to display the Sign In and Sign Out data in the one row, but I'm not sure how to link them considering there's no real unique ID in the table. They can Sign In/Out up to 12 times a day.

Anyone any ideas how to get it to look like:

Agent | Sign In | Sign Out
KD    | datetime | datetime
KD    | datetime | datetime

How can I figure out which Sign Out time is related to which Sign In time?

Thanks!
-Q
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 29 Jun 2012 at 4:08am
There are a couple of things you need to do for this...
 
1.  Group by user and suppress the group header and footer section.
2.  Create a formula that looks something like this:
 
If IsNull({table.Sign_In_Time}) then {table.Sign_Out_Time} else {table.Sign_In_Time})
 
3.  Sort by this formula.  This will sort your data so that you should have a sign out record immediately after the sign in record.
4.  Create a second detail section.
5.  In the first detail section put the Row Number, Agent, and Sign In Time.
6.  In the second detail section put the Sign Out Time in the appropriate column.
7.  Right-click in the grey area to the left of the first detail section and select "Section Expert"
8.  Click on the formula button to the right of "Underlay Following Sections".  In the formula here put something like:
 
{table.User} = next({table.user}) and IsNull(Next({table.Sign_In_Time}))
 
This will set the section to underlay the section with just the sign out time unless you have a sign in record that doesn't have a corresponding sign out record.
 
9.  Still in the Section Expert, click on the button to the right of "Suppress" (DO NOT check Suppress!) and enter a formula like the following:
 
IsNull({table.Sign_In_time})
 
10.  For the section that has the sign out time, click on the button to the right of "Suppress" and enter a formula like:
 
IsNull({table.Sign_Out_time})
 
-Dell
IP IP Logged
Quirky
Newbie
Newbie
Avatar

Joined: 18 Jun 2012
Location: United Kingdom
Online Status: Offline
Posts: 8
Quote Quirky Replybullet Posted: 29 Jun 2012 at 5:01am
Thanks for that :)

Now the only issue is that the underlay doesn't work. It keeps insisting that the SignIn field isn't a field.

Doesn't IsNull work with datetime fields?

Thanks,
-Q
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 29 Jun 2012 at 5:12am
It should work.  What exactly is the formula you're trying to use?
 
-Dell
IP IP Logged
Quirky
Newbie
Newbie
Avatar

Joined: 18 Jun 2012
Location: United Kingdom
Online Status: Offline
Posts: 8
Quote Quirky Replybullet Posted: 29 Jun 2012 at 5:14am
{AgentSignInOutLog.UsersFK}=next({AgentSignInOutLog.UsersFK})
AND isnull(next({AgentSignInOutLog.SignIn}))

It highlights the "next({AgentSignInOutLog.SignIn})" part and says "A field is required here".

IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 29 Jun 2012 at 8:32am
Ahh...I know what the problem is....My fault for forgetting something...
Try using NextIsNull({AgentSIgnInOutLog.SignIn}) instead of IsNull(next(...
 
-Dell
IP IP Logged
Quirky
Newbie
Newbie
Avatar

Joined: 18 Jun 2012
Location: United Kingdom
Online Status: Offline
Posts: 8
Quote Quirky Replybullet Posted: 02 Jul 2012 at 3:53am
Cool :)

The error has vanished, but it still refuses to display the underlay. Truly odd.

Thanks for your help - you got me further than I was before, lol!

-Q

IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum