Das Notes Forum

Domino 9 und frühere Versionen => ND6: Entwicklung => Thema gestartet von: adminnaddel am 01.03.05 - 14:31:08

Titel: doc.lock unter Notes R6
Beitrag von: adminnaddel am 01.03.05 - 14:31:08
Hallo liebe Gemeinde,

eine Db R5 für R6 klar machen und doch immer wieder auf Hindernisse stoßen  >:(

Unter R5 = pdoc.lock = "1"
Unter R6 = pdoc = pdoc.lock ("1",True )

Fazit:
!! von wegen, eben nicht!!  :-X

Hier ein Auszug aus meinem Problem:

We have set up an example database with only one document. This document contains a field named “Lock”.
Then we create an action button in a view with the following code:


Dim Session As New NotesSession
Dim DB As NotesDatabase
Dim DocCol As NotesDocumentCollection
Dim Doc As NotesDocument
Dim MyValue As Variant

Set DB = Session.CurrentDatabase
Set DocCol = DB.AllDocuments
Set Doc = DocCol.GetFirstDocument
MyValue = Doc.Lock(0)


The correct value of the “MyValue” variable in the document is correctly returned to you when running the code in version 5.

In version 6.x this operation triggers the following error message:

Was mache ich denn hier falsch?

lg
Andy
Titel: Re: doc.lock unter Notes R6
Beitrag von: klaussal am 01.03.05 - 14:41:13
Das ist wohl ein reservierter Name !

Aus der Hilfe:
Code
On Error Goto errh
  If doc.Lock("Guys", True) Then
    Print "Document locked"
  Else

klaus
Titel: Re: doc.lock unter Notes R6
Beitrag von: Tode am 01.03.05 - 14:49:28
wie schon erwähnt: lock ist eine neue Methode der NotesDocument- Klasse...

Auszug aus der Designer- Hilfe:

Lock-Method

Locks a document.
Note  This method is new with Release 6.
Defined in
NotesDocument
Syntax
flag = notesDocument.Lock( [ name ] [, provisionalOK ] )

Um Deinen R5- Code abzubilden musst Die eine Zeile umschreiben:

MyValue = Doc.GetItemValue( "Lock" )(0)

Gruß
Tode
Titel: Re: doc.lock unter Notes R6
Beitrag von: adminnaddel am 01.03.05 - 14:56:22
@Klaus ... vielen Dank für deine Antwort!

@Tode ... vielen Dank .. probiere es gleich aus!

lg
Andy
Titel: Re: doc.lock unter Notes R6
Beitrag von: adminnaddel am 01.03.05 - 15:02:27
Etwas macht nun aber stutzig ....

Mit GetItemValue erreiche aber doch nicht das was ich möchte ... ich denke ein:
Call doc.ReplaceItemValue( "lock", "1" ) wäre doch das richtige?!

lg
Andy
Titel: Re: doc.lock unter Notes R6
Beitrag von: Tode am 01.03.05 - 15:39:45
Dein erstes Post zeigt nicht wirkklich, wo Dein Problem liegt...

zuerst postest Du diesen Code:

pdoc.lock = "1"

und direkt darunter diesen Code:

"Hier ein Auszug aus meinem Problem...":

Set Doc = DocCol.GetFirstDocument
MyValue = Doc.Lock(0)

Und für diesen zweiten Code ist das GetItemValue gedacht.... das erste Beispiel muss NATÜRLICH durch ReplaceItemValue ersetzt werden....

Tode
Titel: Re: doc.lock unter Notes R6
Beitrag von: adminnaddel am 01.03.05 - 21:42:17
@All ... danke!

Replace war es, wobei GetItemValue mich auf den Trichter brachter!

Erledigt und danke!

lg
Andy