Solved

Variant does not contain a container error

Posted on 2003-11-13
23
427 Views
Last Modified: 2013-12-18
HI

This used to work and no when I am testing it with a variety of ID's it is giving me an error

If Not doc Is Nothing Then
            
If note.type(0) = "Vac" And  Month(note.StartDate(0)) > 6 Then
      doc.TotalDaysOffCalc = note.TotalDaysOff(0)
      doc.RemainingCalc = doc.TotalAH(0) - doc.TotalDaysOffCalc(0)
Else
If doc.CarriedOverAH(0)= note.NewDaysTotal(0) Then
doc.CarriedOverAH = doc.CarriedOverAH(0) - note.NewDaysTotal(0)
doc.TotalDaysOffCalc = note.TotalDaysOff(0)
doc.RemainingCalc = doc.TotalAH(0) - doc.TotalDaysOffCalc(0)
REM Goto SaveIt      ' Skip normal calc and save the doc
Else
If doc.CarriedOverAH(0) = 0 Then
doc.TotalDaysOffCalc = note.TotalDaysOff(0)
doc.RemainingCalc = doc.TotalAH(0) - doc.TotalDaysOffCalc(0)
                        End If
                  End If
            End If

Thanx

James

0
Comment
Question by:adspmo
  • 10
  • 6
  • 4
  • +2
23 Comments
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 9740503
Turn on the debugger and see where this error is occuring.

basically, what the error means is that you are referencing a variant value where the variant itself is empty or doesnot exist. In your case it could be that the fields are not available on the document

~Hemanth
0
 

Author Comment

by:adspmo
ID: 9740515
I have a feeling this is an edit rights issue

On the Leave Tracking form I have an EditRights field
and the Approvers name is not listed
0
 

Author Comment

by:adspmo
ID: 9740549
Forgot to mention

this is the line
doc.TotalDaysOffCalc = note.TotalDaysOff(0)

James
     
0
 
LVL 14

Expert Comment

by:p_partha
ID: 9740561
Just add these lines :

on the beginning of the code:

On error goto errortrap:


after the code ends and before the end suhb:
have somethign like this

exit sub
errortrap:
msgbox "Error occurred on line number " & erl & " error is " & error
exit sub
0
 
LVL 14

Expert Comment

by:p_partha
ID: 9740564
This is to find out where the error occurs, so that we can give u a proper answer

Partha
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 9740648
If you are having author access rights, then the error would meniton about insufficient rights. But it is code referencing a field value without that being on the document.

I believe it is note.TotalDaysOff(0) which is causing problem, where you are referencing the index value without the TotalDaysOff on the note document.

1. Check the spelling of the field being referenced.. is this field physically on the document or created via script ?
2. msg out the vaue like this Msgbox cstr(note.TotalDaysOff(0))


0
 

Author Comment

by:adspmo
ID: 9740772
WEll I added the message box and it came up with a valu once and after that it was variant blabla...

Here is formula forTotalDaysOff
Requested :=NewDaysTotal; "Another field that calculates only weekdays

Booked := @DbLookup( "" : "NoCache" ;""; "AvailHol" ; profile_key;"TotalDaysOffCalc");

Total :=Requested + Booked;

Total1:= HalfDayCalc + Booked;  HalfDayCalc is another field for half day holiday

@If(ApprovalStatus ="Draft";0;HalfDaySel ="";Total;HalfDayCalc != 1; Total1;Total)


0
 

Author Comment

by:adspmo
ID: 9740884
Well
When I look at the document properties box I see a
ServerError Entry not found in index

If I refresh the form alworks well

I guess we need to refresh the form

James
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 9740943
Change this formula to more error proof

Requested :=NewDaysTotal; "Another field that calculates only weekdays

Booked := @DbLookup( "Notes" : "NoCache" ;@DBName; "AvailHol" ; profile_key;"TotalDaysOffCalc");

@if(@IsError(Booked); @Return(0); "");

Total :=Requested + Booked;

Total1:= HalfDayCalc + Booked;  HalfDayCalc is another field for half day holiday

@If(ApprovalStatus ="Draft";0;HalfDaySel ="";Total;HalfDayCalc != 1; Total1;Total)
0
 

Author Comment

by:adspmo
ID: 9741154
I still get the Server Error Entry.....

i did add

Sub Querymodechange(Source As Notesuidocument, Continue As Variant)
      If Source.EditMode Then Call Source.Refresh
End Sub

It does not seem to work, I need to manually press F9

Any ideas

0
 
LVL 14

Expert Comment

by:p_partha
ID: 9741352
justa  suggestoin
Have the form property , automatically refresh fields enabled.


Partha
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:adspmo
ID: 9741366
That property is marked of and has always been
0
 
LVL 14

Expert Comment

by:p_partha
ID: 9741382
What is the datatype of field TotalDaysOff. If it is dialog list or list box, then u can enable refresh fields on keywords change

Partha
0
 

Author Comment

by:adspmo
ID: 9741402
It is a number field
0
 
LVL 14

Expert Comment

by:p_partha
ID: 9741413
It's confusing, what is the value whicih gets populated when u refresh


Partha
0
 

Author Comment

by:adspmo
ID: 9741521
It all depends on what the @If evaluates to either Total or Total1

There must be a way to force a refresh???

Requested :=NewDaysTotal;

Booked := @DbLookup( "" : "NoCache" ;""; "AvailHol" ; profile_key;"TotalDaysOffCalc");

@If(@IsError(Booked); @Return(0); "");

Total :=Requested + Booked;

Total1:= HalfDayCalc + Booked;

@If(ApprovalStatus ="Draft";0;HalfDaySel ="";Total;HalfDayCalc != 1; Total1;Total)
0
 
LVL 14

Expert Comment

by:p_partha
ID: 9741708

Requested :=NewDaysTotal;

Booked := @DbLookup( "" : "NoCache" ;""; "AvailHol" ; profile_key;"TotalDaysOffCalc");

@If(@IsError(Booked); @Return(0); "");

Total :=Requested + Booked;

Total1:= HalfDayCalc + Booked;

@If(ApprovalStatus ="Draft";0;HalfDaySel ="";Total;HalfDayCalc != 1; Total1;Total) ;
@command([viewrefreshfields]);

Partha
0
 

Author Comment

by:adspmo
ID: 9741730
Boy do I feel dumb.  One of the fields that the formula was referring to was after the field listed above ergo the formula had to be forced to refresh

Live and learn
0
 
LVL 9

Expert Comment

by:Arunkumar
ID: 9741926
have a similar field with similar formula hidden on top of the form with a different name.  Use this name for reference.
0
 

Author Comment

by:adspmo
ID: 9741930
Boy do I feel dumb.  One of the fields that the formula was referring to was after the field listed above ergo the formula had to be forced to refresh

Live and learn
0
 
LVL 9

Expert Comment

by:Arunkumar
ID: 9741964
now you have refreshed this page to get second comment of the same kind....
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 9741979
What is the field type .. Computed ?

What is this profie_key ? And how is this document created ?

If this document is created by a script and approver opens it later, then use ComputeWithForm to calculcate all the formula for fields !!

0
 
LVL 31

Accepted Solution

by:
qwaletee earned 300 total points
ID: 9742397
James, please do yourself and everyone here a favor.  Stop using doc" and "note" to represent the employee record and request record.  It ismeaaningless and confusing.  try requestDc and empDoc or something like that.
0

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

Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

758 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

18 Experts available now in Live!

Get 1:1 Help Now