Domino 9 und frühere Versionen > ND6: Entwicklung

Variant in String casten geht nicht :-(

<< < (2/3) > >>

Axel:
Hi,

mit NotesItem.Type kannst du den Typ des Feldes auslesen.

Beisp:

Dim doc As NotesDocument
Dim item As NotesItem
Dim itemType As Integer
'...set value of doc...
Set item = doc.GetFirstItem( "Topic" )
itemType = item.Type

Auszug aus der Designer-Hilfe:


--- Zitat ---Data type
Constant of type long

Syntax
To get: itemType% = notesItem.Type

Legal values
ACTIONCD (16) means saved action CD records; non-Computable; canonical form.
ASSISTANTINFO (17) means saved assistant information; non-Computable; canonical form.
ATTACHMENT (1084) means file attachment.
AUTHORS (1076) means authors.
COLLATION (2).
Hinweis  This value is new with Release 6.
DATETIMES (1024) means date-time value or range of date-time values.
EMBEDDEDOBJECT (1090) means embedded object.
ERRORITEM (256) means an error occurred while accessing the type.
FORMULA (1536) means Notes formula.
HTML (21) means HTML source text.
ICON (6) means icon.
LSOBJECT (20) means saved LotusScript Object code for an agent.
MIME_PART (25) means MIME support.
NAMES (1074) means names.
NOTELINKS (7) means link to a database, view, or document.
NOTEREFS (4) means reference to the parent document.
NUMBERS (768) means number or number list.
OTHEROBJECT (1085) means other object.
QUERYCD (15) means saved query CD records; non-Computable; canonical form.
READERS (1075) means readers.
RICHTEXT (1) means rich text.
SIGNATURE (8) means signature.
TEXT (1280) means text or text list.
UNAVAILABLE (512) means the item type isn't available.
UNKNOWN (0) means the item type isn't known.
USERDATA (14) means user data.
USERID (1792) means user ID name.
VIEWMAPDATA (18) means saved ViewMap dataset; non-Computable; canonical form.
VIEWMAPLAYOUT (19) means saved ViewMap layout; non-Computable; canonical form.

--- Ende Zitat ---

Axel

Thomas Schulte:

--- Zitat von: js84 am 10.08.05 - 08:59:30 ---Und ich muss auf dem FrontEnd machen, da die Werte,die ich auslese noch nicht gespeicherte wurden.

--- Ende Zitat ---
Und da wirst du Schwierigkeiten bekommen, denn soweit ich weis kann man Richttextfelder solange das Dokument nicht gespeichert wurde immer noch nicht ansprechen.

Mandalor:
das doc muss vor dem ansprechen gespeichert und neu geöffnet werden und dann muss ein flag gesetzt werden, der es löscht, sollte der Nutzer es nicht wirklich speichern wollen.

du kannst auch das doc mit einem anderen Form-Feld "zwischenspeichern" und es am schluß wieder löschen

js84:
Also, ich hab das so weit gelöst, dass ich den Typ des Feldes abfrage und je nachdem die Feldwerte hole, unabhängig davon ob der Wert jetzt aktuell ist oder nicht (RichTextFeld).

So jetzt will ich die beiden Werte vergleichen, aber egal was ich mache die Funktion Strcompare gibt nie "0 " also, gleich zurück.
Im debugger sind die Werte aber identisch

Das is der Code:

Dim workspace As New NotesUIWorkspace
   Dim s As New NotesSession
   Dim db As NotesDatabase
   Dim doc As NotesDocument
   Dim nam As NotesName
   Dim p_status,author As Variant
   Dim item As NotesItem
   
   Dim firstsplit,finalsplit,erg_firstsplit,history_erg As String
   Dim lastmodified,historystring, history,historyfield,historycontent,history_erg_help As String
   Dim fieldcontent,fieldcontent_help As String
   Dim itype As Long
   Dim count As Integer
   
   Set db = s.CurrentDatabase
   Set doc=Source.Document
   historyfield=fieldname &"_History"
   historycontent=Source.FieldGetText(historyfield)
   
   
   
   Set item=doc.GetFirstItem(fieldname)
   
   itype=item.Type
   'rich text field
   If itype=1 Then
      fieldcontent=Cstr(item.text)
   'text field   
   Elseif itype=1280 Then
      fieldcontent=Cstr(Source.FieldGetText(fieldname))
   Else
      fieldcontent=""
   End If
   
   
   'emliminate all blanks and new lines   
   fieldcontent_help=Cstr(Replace(fieldcontent,Chr$(13),""))
   fieldcontent_help=Cstr(Replace(fieldcontent_help," ",""))
   fieldcontent_help=Cstr(Replace(fieldcontent_help,";",""))
   
   
   If historycontent="" Then
      Set nam=s.CreateName(s.UserName)
      author=nam.Common
      lastmodified=doc.LastModified
      historystring=";["& author &", <"& lastmodified  & ">];" &  fieldcontent &";"
      historycontent=historystring+historycontent
      Call Source.FieldSetText(historyfield,historycontent)   
      Call Source.Refresh
      
   Else
      
'Split content, get old value
      firstsplit=Split(historycontent,">]")
      erg_firstsplit=Cstr(firstsplit(1))
      
      finalsplit=Split(erg_firstsplit,"[")
      history_erg=Cstr(finalsplit(0))
      
      'emliminate all blanks and new lines   
      history_erg_help=Cstr(Replace(history_erg,Chr$(13),""))
      history_erg_help=Cstr(Replace(history_erg_help," ",""))
      history_erg_help=Cstr(Replace(history_erg_help,";",""))
      
      
      
      'count=Strcomp(history_erg_help,fieldcontent_help,0)
      count=Strcomp(history_erg_help,fieldcontent_help,0)
      If Strcomp(history_erg_help,fieldcontent_help,0)=0 Then
         
      Else
         
         Set nam=s.CreateName(s.UserName)
         author=nam.Common
         lastmodified=doc.LastModified
         historystring=";["& author &", <"& lastmodified  & ">];" &  fieldcontent &";"
         historycontent=historystring+historycontent
         Call Source.FieldSetText(historyfield,historycontent)   
         Call Source.Refresh
         
      End If
      
   End If
   
Ich bin total ratlos
   

Axel:

--- Zitat von: js84 am 10.08.05 - 11:30:32 ---So jetzt will ich die beiden Werte vergleichen, aber egal was ich mache die Funktion Strcompare gibt nie "0 " also, gleich zurück.
Im debugger sind die Werte aber identisch

--- Ende Zitat ---

Anscheinend sind sie aber doch nicht identisch, z.B. Leerzeichen, Groß- bzw. Kleinschreibung usw.

Verwende doch mal StrCompare mit dem Parameter 5 (Case Insensitive, Pitch insensitive) anstatt 0.

Du kannst auch mal so vergleichen:

If history_erg_help = fieldcontent_help Then

oder

Instr(history_erg_help,fieldcontent_help)


Axel

Navigation

[0] Themen-Index

[#] Nächste Seite

[*] Vorherige Sete

Zur normalen Ansicht wechseln