Combined the continuous records into one in Crystal Report XI

I need help for combining the continuous Date1 and Date2 if same ID? What formula or method I can do?
Original Data:
ID               Date1             Date2
1111111  3/16/2009      6/27/2009
1111111  8/20/2009      9/10/2009
1111111  10/14/2009   11/9/2009
1111111  11/9/2009     1/11/2010
1111111  1/11/2010     (blank)
1111111  1/11/2010     1/11/2010
1111111  1/11/2010     6/9/2010
1111111  8/20/2010     9/10/2010
Final Result:
ID               Date1            Date2
1111111  3/16/2009     6/27/2009
1111111  8/20/2009     9/10/2009
1111111  10/14/2009   (blank)
1111111  8/20/2010     9/10/2010
The idea is to eliminate the continuous or repeated records for the same person. The ID indicates a person, Date1 is an open date, and Date2 is a close date. If ID are same, and the date1 is equal to the previous date2, then we keep the earliest date1, which is the previous open date (date1) here and keep the latest close date (date2) if date2 is not empty.
However, empty Date2 means it is not close yet and I am going to take that rather than other Date2 if it is the continuous cases or same Date1 for these records with same ID as well.
If the open date (Date1) is after at least 3 days than the previous close date (previous Date2), we treat it as a new record and it is not continuous even though their ID are same.
I am able to compare two records at a time, but I have no idea to do it when it happens across more than 2 continuous records and not even mention to delete these records and arrange their open date and close date.
Thank you so much for your help!!

Hi Albert, 
We're going to need more information because what you want doesn't quite make sense.  How does
Result:
ID Date1 Date2
1111111 10/14/2009 (blank)
relate when your original data doesn't have these two dates together? 
I'm going to make some huge assumptions here so try this. 
If {table.DATE2} = Date (0, 0, 0) Then
    ToText ({table.ID}, 0, 0, "", "") & ToText (table.DATE1}, "MM/dd/yyyy")
Else ToText ({table.ID}, 0, 0, "", "") & ToText (table.DATE1}, "MM/dd/yyyy") & ToText ({table.DATE2}, "MM/dd/yyyy") ;
If Date2 is null then it build a string with just ID and Date1 otherwise build a string with all three fields. 
Now you can group on this formula to get the distinct values. 
Hope this helps,
Brian

Similar Messages

  • Combined the continuous records into one

    I need help for getting multiple Date1 and Date2 for the same ID? What formula or method I can do?
    Original Data:
    ID                 Date1             Date2
    1111111    3/16/2009      6/27/2009
    1111111    8/20/2009      9/10/2009
    1111111    10/14/2009     11/9/2009
    1111111    11/9/2009      1/11/2010
    1111111    1/11/2010      (blank)
    1111111    1/11/2010      1/11/2010
    1111111    1/11/2010      6/9/2010
    1111111    8/20/2010      9/10/2010
    Final Result:
    ID                 Date1              Date2
    1111111    3/16/2009      6/27/2009
    1111111    8/20/2009      9/10/2009
    1111111    10/14/2009      (blank)
    1111111    8/20/2010      9/10/2010
    Thank you so much.

    Hi Albert, 
    We're going to need more information because what you want doesn't quite make sense.  How does
    Result:
    ID Date1 Date2
    1111111 10/14/2009 (blank)
    relate when your original data doesn't have these two dates together? 
    I'm going to make some huge assumptions here so try this. 
    If {table.DATE2} = Date (0, 0, 0) Then
        ToText ({table.ID}, 0, 0, "", "") & ToText (table.DATE1}, "MM/dd/yyyy")
    Else ToText ({table.ID}, 0, 0, "", "") & ToText (table.DATE1}, "MM/dd/yyyy") & ToText ({table.DATE2}, "MM/dd/yyyy") ;
    If Date2 is null then it build a string with just ID and Date1 otherwise build a string with all three fields. 
    Now you can group on this formula to get the distinct values. 
    Hope this helps,
    Brian

  • How to highlight the repeated records in a BO crystal report?

    Hi ,
    How to highlight the repeated records in a BO crystal report?
    we want to highlight the rows for which account number is same.
    thanks
    sriram

    You don't even need to create a group.  Just sort the records on the fields that define "duplicate".  Then you can just use
    if {field} = PreviousValue({field}) then crYellow else crNoColor
    in the format's Background Color formula.  This will cause the background to be yellow on duplicates.  (If you need to check more than one field in order to determine duplicates, just insert
    and {field2} = PreviousValue({field2}
    and so on for each field that needs to be checked.
    HTH,
    Carl

  • How do I combine three itune accounts into one? Then have three different family member have three different log-in's to sync many different devices to the same itune account ?

    How do I combine three itune accounts into one? Then how do I set up three users for the one Itunes account on ONE Mac Pro Computer with one Itunes program? We are one family with 3 I-Phones, 2- I-Pads, 2- Lap tops and 3-I-Pods and would like to use one main computer to sync all our devices to.

    "How do I combine three itune accounts into one? "
    You cannot.
    "Then how do I set up three users for the one Itunes account on ONE Mac Pro Computer with one Itunes program?"
    You can copy all of the music to one computer and set up different users see:
    Learn how to set up additional user accounts.
    How to use multiple iPods, iPads, or iPhones with one computer

  • HT1473 My girlfriend and I both have iTunes account with our own music libraries and we want to combine our two libraries into one icloude accounts so can both then access our one shared libary at anytime in the cloud.  How do we do this?

    My girlfriend and I both have iTunes account with our own music libraries and we want to combine our two libraries into one icloude accounts so can both then access our one shared libary at anytime in the cloud.  How do we do this?

    No it is not possible.  Content purchased from the iTunes Store is permanently tied to the account from which it was originally purchased, and Apple does not provide a way to change it.

  • Should I combine two 1Tb drives into one logical 2Tb drive or use one 1Tb drive for system/apps and move /users to the other 1Tb drive?  (I'd like ease of b/u too.)

    Hello,
    I have two 1Tb drives in my Mini, the first is full and the second one empty.  (I've been using the 2nd for Time Machine but the full source from dirve 1 soon has Time Machine complaining.)  I am contemplating whether to form one 2Tb logical drive from the two 1Tb drives or segregate their use, i.e. use the first 1Tb drive to hold the system and applications while moving the /users directory tree to the second 1Tb drive?
    I'm assuming both are straight forward to do accomplish but have nagging doubts about segregating drive usage, will moving the /users directory tree to the second 1Tb drive:
    impact apps which might otherwise expect to see particulat fies and directories in specific user related locations on the system drive;
    hinder backing up (by having to setup two separate Time Machine activities)?
    Finally, is there a better 3rt option?
    Thanks,

    Thanks and sorry Allan,
    The supplementary questions would arise should I NOT chose to combine the separate drives into a larger logical one but to keep one of the two drives for system/apps and the other for users data...  I assumed that segregating drive usagel like this might reult in issues with apps which might expect to see some user directories/files on the same drive as the system/apps.  similarly, with two physical drives, I'd be looking to managing separate Time Mchines.  (I have a few 2Tb pocket drives for backups.)
    Final question - if I do combine into a single logical drive (for system, apps, /users ... the whole lot), would I have any problem getting this logical one working from a Time Machine backup?  I ask that this backup was taken from the 1Tb physical drive and now I'd be looking to put it back onto a 2Tb logicl drive.
    Thanks,

  • Hello Apple community... I am trying to combine multiple pdf's into one, using preview, but when I drag the additional pages they show up as separate documents.

    I am trying to combine multiple pdf's into one, using preview, but when I drag the additional pages they show up as separate documents.  When I drag the doc in a line would show up in the past, and if I went above th eline all was good.  It doesn't have a line, and no matter what I try I am having no success.
    Please help!

    According to an Apple Support article, unless there are unforeseen issues
    in file ownership or permissions, the combining of .PDFs should be simple.
    •OS X: Combining PDF documents using Preview - Apple Support
    There are a few variable and similar methods, some change with version
    of OS X in use; some vintage OS X may vary a little in the process...
    A variety of similar topics appear in search results, with terms:
    " mac os x combine pdf into one " such as this page shows...
    https://www.google.com/?gws_rd=ssl#q=mac%20os%20x%20combine%20pdf%20into%20one
    If the system is older than Mavericks there may be other methods to try.
    Suggestions are among linked results in the search. I see a few fair ones.
    •Here's another that offers generally similar suggestions...*  this info looks OK, extra links, do not:
    http://osxdaily.com/2014/06/27/how-to-join-multiple-pdf-files-into-a-single-pdf- document-in-mac-os-x/
    { note: avoid clicking on links to products in * this ^ page, since they likely will not help & may be adware prone }
    If you have a problem after trying other methods, based on an OS X
    your computer is running, post back with more exact information...
    Good luck & happy computing!
    edited

  • How do I combine all my calendars into one and delete the others?

    I have a work computer, a home desktop, and Apple air laptop and an 1phone 4s.
    I use Outlook calendar for all my appointments and only need one calendar.
    When I get notifications of my upcoming events on the Oulook page and on my iphone, I get multiple notifications, sometimes as many as 6 times.
    How can I combine all my calendars into one and delete the others?

    Your old account is the one you migrated, but it has been renamed because the new account had the same name. "Fixing" this is a bit complicated. It is possible to transfer data from one account to the other. See Transferring files from one User Account to another.
    A cleaner solution is to do this:
    Create a temporary new admin user account with a completely different username.
    Log into this new account.
    Delete the new account you created before migrating.
    Delete the old account you migrated that has the changed name.
    Re-migrate your old account from the Mini.
    Log into the newly migrated account and delete the temporary account.
    And, the simplest solution is to use the migrated account as-is and delete the account you originally made on the new computer.

  • I have Windows 7, with Office 10, Acrobat Adobe 9 Std. I used to be able to combine pdf files into one pdf until I converted to Office 10. Now when I combine 3 pdf files into one pdf, I am missing the middle pdf. Pages are there but the pages are blank. A

    I have Windows 7, with Office 10, Acrobat Adobe 9 Std. I used to be able to combine pdf files into one pdf until I converted to Office 10. Now when I combine 3 pdf files into one pdf, I am missing the middle pdf. Pages are there but the pages are blank. Any Idea???

    [discussion moved to Creating, Editing & Exporting PDFs forum]

  • How to add the records of 2 internal table records into one file

    hello experts,
    My scenario is...
    I am retrieving the data for the for the credit, debit and trailer records of the customer into 3 different internal tables and finally i have to append all those records into one file first debit records then credit records finally the trailer record.... how to do that can anyone give some idea plzzzzzzzzz..
    Plz its bit urgent..
    Thanks a lot for your anticipation
    SRI

    Hello,
    Do like this.
    " Assume u have three itab.
    "Itab1 - debit
    "Itab2 - credit
    "Itab3 - Credit.
    REPORT ZV_TEST_SERVER .
    *PARAMETERS: P_FILE TYPE STRING."RLGRAP-FILENAME.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
    *   BIN_FILESIZE                  =
        FILENAME                      = P_FILE
    *   FILETYPE                      = 'ASC'
       APPEND                        = 'X'  " Check here
    *   WRITE_FIELD_SEPARATOR         = ' '
    *   HEADER                        = '00'
    *   TRUNC_TRAILING_BLANKS         = ' '
    *   WRITE_LF                      = 'X'
    *   COL_SELECT                    = ' '
    *   COL_SELECT_MASK               = ' '
    *   DAT_MODE                      = ' '
    * IMPORTING
    *   FILELENGTH                    =
      TABLES
        DATA_TAB                      = ITAB1
    * EXCEPTIONS
    *   FILE_WRITE_ERROR              = 1
    *   NO_BATCH                      = 2
    *   GUI_REFUSE_FILETRANSFER       = 3
    *   INVALID_TYPE                  = 4
    *   NO_AUTHORITY                  = 5
    *   UNKNOWN_ERROR                 = 6
    *   HEADER_NOT_ALLOWED            = 7
    *   SEPARATOR_NOT_ALLOWED         = 8
    *   FILESIZE_NOT_ALLOWED          = 9
    *   HEADER_TOO_LONG               = 10
    *   DP_ERROR_CREATE               = 11
    *   DP_ERROR_SEND                 = 12
    *   DP_ERROR_WRITE                = 13
    *   UNKNOWN_DP_ERROR              = 14
    *   ACCESS_DENIED                 = 15
    *   DP_OUT_OF_MEMORY              = 16
    *   DISK_FULL                     = 17
    *   DP_TIMEOUT                    = 18
    *   FILE_NOT_FOUND                = 19
    *   DATAPROVIDER_EXCEPTION        = 20
    *   CONTROL_FLUSH_ERROR           = 21
    *   OTHERS                        = 22
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
    *   BIN_FILESIZE                  =
        FILENAME                      = P_FILE
    *   FILETYPE                      = 'ASC'
       APPEND                        = 'X'  " Check here
    *   WRITE_FIELD_SEPARATOR         = ' '
    *   HEADER                        = '00'
    *   TRUNC_TRAILING_BLANKS         = ' '
    *   WRITE_LF                      = 'X'
    *   COL_SELECT                    = ' '
    *   COL_SELECT_MASK               = ' '
    *   DAT_MODE                      = ' '
    * IMPORTING
    *   FILELENGTH                    =
      TABLES
        DATA_TAB                      = ITAB2  " Check here
    * EXCEPTIONS
    *   FILE_WRITE_ERROR              = 1
    *   NO_BATCH                      = 2
    *   GUI_REFUSE_FILETRANSFER       = 3
    *   INVALID_TYPE                  = 4
    *   NO_AUTHORITY                  = 5
    *   UNKNOWN_ERROR                 = 6
    *   HEADER_NOT_ALLOWED            = 7
    *   SEPARATOR_NOT_ALLOWED         = 8
    *   FILESIZE_NOT_ALLOWED          = 9
    *   HEADER_TOO_LONG               = 10
    *   DP_ERROR_CREATE               = 11
    *   DP_ERROR_SEND                 = 12
    *   DP_ERROR_WRITE                = 13
    *   UNKNOWN_DP_ERROR              = 14
    *   ACCESS_DENIED                 = 15
    *   DP_OUT_OF_MEMORY              = 16
    *   DISK_FULL                     = 17
    *   DP_TIMEOUT                    = 18
    *   FILE_NOT_FOUND                = 19
    *   DATAPROVIDER_EXCEPTION        = 20
    *   CONTROL_FLUSH_ERROR           = 21
    *   OTHERS                        = 22
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
    *   BIN_FILESIZE                  =
        FILENAME                      = P_FILE
    *   FILETYPE                      = 'ASC'
       APPEND                        = 'X'  " Check here
    *   WRITE_FIELD_SEPARATOR         = ' '
    *   HEADER                        = '00'
    *   TRUNC_TRAILING_BLANKS         = ' '
    *   WRITE_LF                      = 'X'
    *   COL_SELECT                    = ' '
    *   COL_SELECT_MASK               = ' '
    *   DAT_MODE                      = ' '
    * IMPORTING
    *   FILELENGTH                    =
      TABLES
        DATA_TAB                      = ITAB3 " Check here
    * EXCEPTIONS
    *   FILE_WRITE_ERROR              = 1
    *   NO_BATCH                      = 2
    *   GUI_REFUSE_FILETRANSFER       = 3
    *   INVALID_TYPE                  = 4
    *   NO_AUTHORITY                  = 5
    *   UNKNOWN_ERROR                 = 6
    *   HEADER_NOT_ALLOWED            = 7
    *   SEPARATOR_NOT_ALLOWED         = 8
    *   FILESIZE_NOT_ALLOWED          = 9
    *   HEADER_TOO_LONG               = 10
    *   DP_ERROR_CREATE               = 11
    *   DP_ERROR_SEND                 = 12
    *   DP_ERROR_WRITE                = 13
    *   UNKNOWN_DP_ERROR              = 14
    *   ACCESS_DENIED                 = 15
    *   DP_OUT_OF_MEMORY              = 16
    *   DISK_FULL                     = 17
    *   DP_TIMEOUT                    = 18
    *   FILE_NOT_FOUND                = 19
    *   DATAPROVIDER_EXCEPTION        = 20
    *   CONTROL_FLUSH_ERROR           = 21
    *   OTHERS                        = 22
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    If useful reward.
    Vasanth

  • Combining several iMovie projects into one, time-not space-being the factor

    Hello,
    Space is not an issue (large external drive), but I'm trying to figure out the fastest way to combine several iMovie projects into one (so each movie will become a chapter in iDVD). I'm pretty sure there must be a better way than I'm attempting, selecting all the clips in clipviewer, then dragging and dropping to the new project clipviewer. As I've done this, the "time remaining" window keeps growing (started out about 4 minutes, climbed to "92 minutes remaining," then I aborted the move). Details: each movie is about 8-10 minutes long, widescreen, made up of various (sometimes many) dv clips, audio segments, still photos, etc.
    I have added dv clips to a project via the media folder (project unopened), but this was a single item and simple to move from trash into the project. In this case, I'm not sure what to move in order to save the entire project intact.
    Thanks so much for any help,
    b
    Message was edited by: Bimp

    Thanks for your reply, Klaus. I'm just now getting to try your suggestion to copy and paste from timeline rather than drag and drop from clipviewer. Alas, it seems to be choking terribly on the transfer. This video is not a 60 minute movie, either; it's about ten minutes. I has about 60 files to it. I did get to the point where I felt confident enough to empty the trash and save the project, so I assume the clips that are there are not still "attached" to the unedited dvs.
    Earlier I tried to export, in the advanced settings, to the full quality dv, but the quality really dropped, way too much for the intended use. I'm pretty much stumped at this point, unless I can hear some other suggestions.
    What I might try doing is simply dragging and dropping all the packet contents of the media folder into the other movie's media folder, but then I suspect I'll have to rebuild the darn thing from bits and pieces and it may be like putting Humpty Dumpty back together again...ugh.
    I'm sure I'm not the first person to face this challenge, am I? Of course, my lesson learned is to build one dvd's contents in one imovie project. If it weren't for the fact that I need to offer viewers the option to "play movie" (play all the videos as one movie) I'd simply drag each movie into iDVD and do it that way (the dvd showing each video separately).
    Would still love to hear of other possible solutions here, before trying some other forum.
    thanks!
    B

  • How do I combine two user accounts into one account?

    When we originally set-up our iMac, I set-up two accounts for my wife and I. Since then it has been a royal pain with music and applications sharing. How do I merge the two accounts into one?

    I found an answer to this by searching on "merging two accounts" rather than "combining two accounts." BTW, it's a little mini-nightmare if you only use "combine" on both Google and Apple support. At least this post might help others avoid the same fate.
    Here's where to go to find the answer: http://discussions.apple.com/message.jspa?messageID=5629676#5629676

  • How can I combine two itunes accounts into one?

    How can I combine two itunes accounts into one?

    Items purchased from the iTunes Store are permanently associated with the account from which they were originally purchased.  Apple provides no way to change this.
    However, if you wish to put content from two accounts into a single iTunes library, you can easily do so.  Use the command File > Add File (or Folder) to Library.

  • How to concatenate multiple records into one

    Hi everybody:
    I want to know if exist some way to concat multiple records into one without using cursors. For example, I have a table named "Authors" like this:
    Lan|Author
    English|Ernest Hemingway
    Spanish|Octavio Paz
    Spanish|Mario Vargas Llosa
    English|Sinclair Lewis
    Spanish|Gabriel García Márquez
    And I want to get this:
    Author
    Octavio Paz, Mario Vargas Llosa, Gabriel García Márquez
    I have worked with SQL Server and I can do something like this:
    CREATE FUNCTION dbo.MyConcat (@lan varchar(10))
    RETURNS varchar(5000) AS
    BEGIN
    declare @retvalue varchar(5000)
    set @retvalue=''
    select @retvalue = @retvalue + Author +',' from Authors where lan = @lan
    return substring(@retvalue,1,len(@retvalue)-1)
    END
    ie, do not use cursors to concatenate records. However, with ORACLE, I have to do someting like this.
    FUNCTION MyConcat(P_Lan IN VARCHAR2) RETURN VARCHAR2 IS
    v_ret VARCHAR2(4000);
    v_element VARCHAR2(4000);
    v_cursor sys_refcursor;
    BEGIN
    OPEN v_cursor FOR SELECT Author FROM Authors where Lan = P_Lan
    LOOP
    FETCH v_cursor INTO v_elemento;
    EXIT WHEN v_cursor%NOTFOUND;
    IF v_ret IS NULL THEN
    v_ret := v_element;
    ELSE
    v_ret := v_ret || ', ' || v_element;
    END IF;
    END LOOP;
    RETURN v_ret;
    END;
    Exist some other way to do this?
    Best Regards
    Jack

    Tks both for answer... I forgot to mention that I am using Oracle 10g. I read about LISTAGG() but this function is available for Oracle 11g release 2.
    I wil read about the other techniques than Hoek mention
    Best Regards.
    Jack

  • Concatenate multiple records into one single record

    Hello everyone,
    Can anyone guide me how to merge multiple records into one single record
    like......... I am getting the data in the file like
    aaaaa/bbbbbbb/ccccccccccc/dddddddddddd/eee
    ffffff/gggg/hhhhhhhhhhhhhh
    /123/4567/55555/99999999/kaoabfa/eee
    fffff/kkkkkkkk/llllllllllllllllllllllll
    when i use gui_upload I am getting the data into the internal table in the above format.
    My main intension is to split the record at / to multiple lines and dowload it into another file.
    What i am planning to do is... if the line does not start with / then i want to concatenate the multiple lines into single line and then split it into multiple records. Can anyone guide me how to achieve this.

    Yes, it should work.
    In my example
    Loop at itab.
    concatenate i_text itab into i_text.
    endloop.
    You change that loop for the loop of your internal table with the file records
    So if you have this three records
    'aaaa/bbb/ccc'
    '/dddd/efg'
    'hijk/lmn'
    i_text will look like this at the end
    'aaaa/bbb/ccc/dddd/efghijk/lmn'
    then in this part of the code
    split i_text at '/' into table itab2.
    itab2 will have the records looking like this
    aaaa
    bbb
    ccc
    dddd
    efghijk
    lmn'

Maybe you are looking for

  • PCH: Value help for Object ID

    Hi Experts, I have a question regarding Logical Database PCH. We know LDB PCH is OM based and we have  default "Object ID field " and "Reporting period field " at the selection screen. I have kept "Reporting period" as "Key date" 31.12.2010. I  wante

  • Unable to Connect to itunes & it won't  recognize iPod

    "ITunes could not connect to the ITunes store. The network connection timed out. Make sure your network connection is active then try again" For the past 24 hours, I have been getting this error code. I live with a roommate and their connection is ru

  • Resize slide question

    I am trying to convert a slide show that is in a 4x3 aspect ratio to a custom 8x3 aspect ratio. I have changed the slide size from 1024x768 to 2048x768, and that works fine. However, I need to old 4x3 slide content to be on the left side; currently i

  • Safari 7.02 does not save my preference or view changes

    Safari 7.02 does not save my preference or view changes

  • IPhone 5 died after installing iOS 8. Is Apple store responsible?

    We installed iOS 8.0 on iPhone 5, 16 gig. The second time we tried to charge it, the phone started flashing between the low battery screen and the Apple screen. Never got it going, tried the reset and all. Brought it to the Apple store and they told