Solved

Looping for a particular datetime

Posted on 2008-10-22
6
351 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Hi, I am very much excited today since I'm going to share something very exciting Tool used for Analytical Reporting and that's nothing but MICROSTRATEGY. Actually there are lot of other tools available in the market for Reporting Such as Co…
Hello, In my precious Article  (http://www.experts-exchange.com/Database/Reporting/A_15280-Create-Project-in-Microstrategy-Part-I.html)we saw the Configuration part for Microstrategy which included Metadata Creation and DataSource Preparation as …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now