comparing arrays and deleting values

Posted on 2006-05-29
Last Modified: 2013-12-18

If I have two date arrays and a third array which has the dates in array1 and not in array2, If I initiate a delete on the third array which has the remaining subset of data existing in array1, would these dates be also deleted of array1?

What I am trying to do is to get a smaller list of Array1 which if I don't need I can delete, but I don't want only delete it from the third array(result of comparion), i also wanted deleted from the initial array1.

Thank you
Question by:varvoura
    LVL 18

    Expert Comment

    Formula or Lotusscript?
     Are you saying array1: a, b,c
    array2: d,e,f
    array3: a, d, f

    Author Comment

    I think lotusscript.
    This also brings us to your interval and interval_old stuff and life_cycle and Life cycle_old fields.

    Re: ....Agent

    what I want to do on postsave is to check between the two values of interval and interval_old and if they are different, then delete the dates in array one which have no completed status and that's determined by the array comparison which I have done on both testdates and completeddates arrays, where the resulted array3 has those remaining dates. Then once they are deleted from that third array as well as array1, I can revisit and recreate the remaining tests for the year based on the new interval.
    Same thing goes for the life cycle....

    Thank you
    LVL 18

    Accepted Solution

    Fields on the form:
    TestDates: the current test Date array
    TestDates_OLD: the Old Dates to see if data has changed
    Completed_Dates: A dblookup to a view containing a list of completed test documents categorized by parentdocID
    Created_Dates: A dblookup to view containing all test documents created, categorized by parentdocid

    Lookup Views:
    Created View: view containing all test documents created, categorized by parentdocid
    Completed View: view containing a list of completed test documents categorized by parentdocID
    Checkfordups view: parentdocID + testDate in first column, sorted.

    Document Process Logic:
      When saved, refresh UIDOC and decide if anything has changed
      If this is a new doc, then simply create the new test documents
      If this is a previously save document, then
            Get OldDates from the doc.TestDates Field
            Process and create a new Array: NewDates of new Test Dates
          doc.TestDates = NewDates
            doc.OldDates = OldDates

            Completed= doc.Completed_Dates
            Created_Docs = doc.Created_Dates

    'You want to keep newDates and Completed_Dates.

    Dim KeepThese as variant
          if len(completed(0))<>0 then
                keepthese = arrayappend(NewDates, Completed)
                KeepThese = NewDates
          end if

    'Now remove the KeepThese from the Created_Docs
          Dim deleteThese as variant
          Dim nullArray(0) as string
          nullArray(0) = ""

          if len(Created_Doc(0))<>0 then
                 DeleteThese = arrayreplace(Created_Docs,Keepthese, NullArray)
                 DeleteThese(0) = ""
          end if

    If len(deleteThese(0))>0 then 'delete the documents having these dates and this parentunid.

    Refresh the chkfordups view 'parentunid+testdate first column

    'Now create the new testdocuments using the newDates
          create the lookupkey (parentunid + testdate)
          set testdoc= view.getdocumentbykey(lookupkey, true)
          if testdoc is nothing then create the testdoc
          get the next date  in the array.

    time to create: 3  hours.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    This is an old article, please see an updated version of this article, located here:
    I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    how to add IIS SMTP to handle application/Scanner relays into office 365.

    733 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

    25 Experts available now in Live!

    Get 1:1 Help Now