Solved

Looping for a particular datetime

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Hi, In my previous Article  (http://www.experts-exchange.com/Database/Reporting/A_15199-Introduction-to-Microstrategy.html)I discussed some basic understanding of Microstrategy that how we can get in Intro of Microstrategy (MSTR). Now it's tim…
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 …
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

929 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

15 Experts available now in Live!

Get 1:1 Help Now