troubleshooting Question

Urgent Help

Avatar of varvoura
varvoura asked on
Lotus IBM
9 Comments2 Solutions247 ViewsLast Modified:
Hi all,


Test Type = checkbox field with 2 values

Test
Appraisal

Form has many date field for the purpose of this one,

Test type – dates belong to projdates_1 field
Appraisal Type Dates belong to projapps_1 field

At the moment, the calendar drag and drop works fine if either of these type is selected.
But in majority of cases, the user needs both of these two types selected which will then calculated in conjunction with other field(interval, startdate, enddate, etc..) 2 sets of test and appraisal dates for this product. Those then are populated in the first column of the calendar (Projdates_1:Projapps_1) which is also set to display multiple entries as separate entries.

PROBLEM

When both types are checked, I get the error, the drag and drop facility won’t work and I get the error “Type Mismatch” when I tried to drag either a “Test” or an “Appraisal” entry.

How can I go around this problem, keeping in mind that in majority of cases both types needs to be checked and I will only drag one entry(one type) at the time so they’ll be the need to distinguish which type does the entry belongs to.

Then I declared and set the following:
Projdates  = doc.projdates_1(0)
Projapps_1=doc.projapps_1(0)

I have tried to work with instr(1, projdates, SelectedDate) to see if the SelectedDate belong to projdates_1 field then I will set the “tmplist” to doc.projdates_1 field on the product form and I will set “tmplist” to doc.proapps_1 if the SelectedDate belongs to Projapps but none of this worked.

Below is my current code, I hope someone can help me modify this to get it to work


Sub Postdragdrop(Source As Notesuiview)
      
      Dim session As New NotesSession
      Dim db As notesdatabase
      Set db = session.currentdatabase
      
      Dim uiw As New NotesUIWorkspace
      Dim uidoc As NotesUIDocument
      Set uidoc = uiw.CurrentDocument
      Dim doc As NotesDocument
      Set doc = db.GetDocumentByID( source.CaretNoteID )
      
      Dim fromList As Variant
      Dim tmpList As Variant
      Dim toList As Variant
      Dim oldList() As String
      Dim newList ()As Variant
      Dim projdates As Variant
      Dim proapps As Variant
      Dim testtype As String
      testtype = doc.testtype(0)
      projdates=doc.projdates_1(0)
      projapps=doc.projapps_1(0)
      
      SelectedDate = uiw.CurrentCalendarDateTime
      fromDate = Cstr( Datevalue(uiw.CurrentCalendarDateTime ) )  
      
      toDate = Cstr( source.CalendarDateTime )
      
      fromDate = Left( fromDate, Len( fromDate))
      
      Dim excludeweekends As String
      excludeweekends=doc.excludeweekends(0)
      
      If excludeweekends = "Yes" Then
            If Weekday(toDate) = 1 Or Weekday(toDate) = 7 Then
                  Msgbox |You can't move this test to the weekend because you have selected to exclude weekends on the Client Record.  Please select another day| , _
                  MB_ICONINFORMATION, "You can't move this test to the weekend. Please select a weekday to move this test to"
                  Exit Sub
            End If      
      End If
      
      toDate = Left( toDate, Len( toDate ))
      Dim date3 As Variant
      date3 = Cdat(todate) - Cdat(fromdate)
      
      If testtype = "Test" Then
            
            tmpList =doc.projdates_1
            
      End If
      
      If testtype = "Appraisal" Then
            
            tmpList =doc.projapps_1
            
      End If
      
      i=0
      
      Forall x In tmpList
            Redim Preserve oldList(i)
            oldList(i) = Format$(x, "Short Date")
            i = i + 1
      End Forall
      
      fromList = MakeArray( fromDate )
      toList = MakeArray( toDate )
      
      Dim askme As Integer
      askme = uiw.Prompt (PROMPT_YESNO, _
      "Test Schedule", "Would you like to move all future test schedule for this hose ?")
      
      Dim newlist1 As Variant
      If askme=1 Then
            newlist1 = oldlist
            i = 0
            Forall x In newList1
                  Redim Preserve newlist(i)
                  newlist(i) = Cdat(x) + date3
                  i = i+1
            End Forall
      Else
            
            newList1 = Arrayreplace(oldList, fromList, toList )
            i = 0
            Forall x In newList1
                  Redim Preserve newlist(i)
                  newlist(i) = Cdat(x)
                  i = i+1
            End Forall
            
      End If
      
      If testtype = "Test" Then
            
            doc.projdates_1= newList
            doc.testdates = newlist
            Call doc.Save( True, True, True )
            Call uiw.ViewRefresh
            
      End If
      
      If testtype = "Appraisal" Then
            
            doc.projapps_1= newList
            doc.appraisaldates = newlist
            Call doc.Save( True, True, True )
            Call uiw.ViewRefresh
            
      End If
      
End Sub


Many thanks
Varvoura
ASKER CERTIFIED SOLUTION
marilyng

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 9 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros