comparing arrays and deleting values

Hi,

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
varvouraAsked:
Who is Participating?
 
marilyngCommented:
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)
      else
            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)
      else
             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.
0
 
marilyngCommented:
Formula or Lotusscript?
 Are you saying array1: a, b,c
array2: d,e,f
array3: a, d, f
0
 
varvouraAuthor Commented:
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
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.