Solved

Looping for a particular datetime

Posted on 2008-10-22
6
354 Views
Last Modified: 2013-11-15
I have a databases which stores dates for a particular process.  The process can have many different elements i.e can be changed from one stage to another, pending, here, their, anywhere...

example

Process 123456
                                MODDATE                                                STAGEDATE
                          1      13/10/2008  10:06:31                             13/10/2008  10:06:31
                          2      13/10/2008  10:06:31                             13/10/2008  10:06:31
                          3      13/10/2008  10:09:45                             13/10/2008  10:06:31
                          4      13/10/2008  10:46:08                             13/10/2008  10:49:31
                          5      13/10/2008  10:51:19                             13/10/2008  10:51:20

Here the stage date is what is of interest.  I need to use crystal, a formula Im assuming to get the STAGEDATE which signifies a change.  In this case it would be RowNum 4 albeit 5 is different Im only interested in 4.  How can I use Crystal to look through each record to do it .  Bear in mind their are 1000s of different processes.  A typical process could be - PAYJOEBLOGGS which has several elements in its actual completion such as start, pending, waiting, departmentx etc.  The table is called PROCESS and each unique processID has lots of different elements as I have depicted above, 1,2,3,4 & 5 all belong to process 123456.  Im messing abotu with WHILEREADINGRECORD etc but I think a loop is needed.

Thanks


0
Comment
Question by:BPMonk
  • 2
  • 2
6 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 22777494
You cannot truly loop through the records in Crystal.

Crystal works on 1 record at a time and handles the "looping" for you.

You can group on the process id
In the detail sectiion you can add a formula that compares the ModDate and Stage date  like

If {ModDateField} <> {StageDateField} then
    Do something

mlmcc
0
 

Author Comment

by:BPMonk
ID: 22783650
Trouble is mlmcc is that I need to get only the one record where their was a change, in thsi case

4      13/10/2008  10:46:08                             13/10/2008  10:49:31

I then need to compare this to the start time 13/10/2008  10:06:31    and acquire the difference.
0
 

Author Comment

by:BPMonk
ID: 22783693
What I could do is set a flag where their is a change i.e

                          1      13/10/2008  10:06:31                             13/10/2008  10:06:31                      0
                          2      13/10/2008  10:06:31                             13/10/2008  10:06:31                      0
                          3      13/10/2008  10:09:45                             13/10/2008  10:06:31                      0
                          4      13/10/2008  10:46:08                             13/10/2008  10:49:31                      1
                          5      13/10/2008  10:51:19                             13/10/2008  10:51:20                      2

This sets the first change as 1 and the second as 2.  I can then get rid of antything that isnt 1 then write a formula to calculate the variance...
0
 
LVL 100

Accepted Solution

by:
mlmcc earned 250 total points
ID: 22786475
I assume you have a group on the process id
In the group header add a formula
WhilePrintingRecords;
Global DateTimeVar ProcessStartTime;
ProcessStartTime := {ModDate};
''

In the formula I provided

WhilePrintingRecords;
Global DateTimeVar ProcessStartTime;
If {ModDateField} <> {StageDateField} then
    DateDiff('s',   ProcessStartTime, {StageDateField})

If you want to display it as something other than seconds then you need to add code to convert the seconds to the format you want.

mlmcc
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem Statement In an SAP BI BO Integration project when a BO universe is built on a BEx query, there can be an issue of unit & formatted value objects not getting generated in a BO universe for some key figures. This results in an issue whereb…
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question