?
Solved

Looping for a particular datetime

Posted on 2008-10-22
6
Medium Priority
?
357 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
6 Comments
 
LVL 101

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 101

Accepted Solution

by:
mlmcc earned 1000 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

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…
Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

770 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