Domino 9 und frühere Versionen > Entwicklung

Script: Isempty(Feld) immer False

(1/2) > >>

Don Pasquale:
Hi Folks,

Ich will eine Abfrage, ob das Feld eines Dokuments
leer ist oder nicht.
isempty(Feldname) ergibt bei mir aber immer ein
false, egal ob da was drin steht oder nicht.

Wo ist mein Denkfehler ?

Don Pasquale


--- Code: ---
     Dim ws As New NotesUIWorkspace  
     Dim session As New NotesSession
     Dim db As NotesDatabase
     Dim collection As NotesDocumentCollection
     Dim doc As NotesDocument  
     Dim stringArray As String  
     Dim composed As String  
     Dim idx As Integer
     Dim temp As Variant                  
     Dim Anzeigetext As String
     Set db = session.CurrentDatabase
     Set collection = db.UnprocessedDocuments  'Alle markierten Docs in die Kollection
     
     For idx = 1 To collection.Count
           Set doc = collection.GetNthDocument(idx)
           
           If Isempty(doc.pe_Identnummer(0)) Then
                 Messagebox "Es ist empty"
           Else
                 Messagebox Isempty(doc.pe_Identnummer(0))
           End If

next

--- Ende Code ---

manuel:
Probiers besser mit

If doc.pe_Identnummer(0) = "" Then ...


Schönen Gruß
Manuel

manuel:
Noch ein Tipp, verwende statt deiner For-Schleife eine While

...

Set collection = db.UnprocessedDocuments  'Alle markierten Docs in die Kollection  
Set doc = collection.GetFirstDocument
 
While Not (doc Is Nothing)
 
 If Isempty(doc.pe_Identnummer(0)) Then
  Messagebox "Es ist empty"
 Else
  Messagebox Isempty(doc.pe_Identnummer(0))
 End If

Set doc = collection.GetNextDocument(doc)
Wend


Begründung: http://217.160.137.156/html/cgi-bin/yabb/YaBB.pl?board=R5TIP;action=display;num=1018593291

Don Pasquale:
Hallo Manuel,

Vielen Dank für Deine Tipps,

Mit Doc.Identnummer(0)="" bekam ich immer ein : "Type Mismatch"

Ich hab´s es so gelöst :

Dim Inhalt As String
Inhalt = ""
Inhalt =doc.pe_Identnummer(0)
If Inhalt ="" Then
           Messagebox "Leer"
End If

Das andere schau ich mir gleich an

Gruß
Pascal

manuel:
Könnte das "Type Mismatch" vielleicht daran liegen, dass du bei Doc.Identnummer(0)="" etwas vergessen hast. Beim Inhalt =doc.pe_Identnummer(0) hast du es wieder richtig gemacht.

Navigation

[0] Themen-Index

[#] Nächste Seite

Zur normalen Ansicht wechseln