Domino 9 und frühere Versionen > ND6: Entwicklung

Picklist - Kategorien

<< < (2/4) > >>

wuwu:
hallo roalf,

würde es gerne über script realisieren, stehe momentan voll am Schlauch, ich weis gar nicht wo & wie ich anfangen sollte, kannst du mir da ein wenig auf die Sprünge helfen?

Mfg Horst

brixxton:
Versuch diesen Quellcode anzupassen das es bei dir funktioniert.


--- Zitat ---Sub Postopen2(Source As Notesuidocument)
   
   Dim se As New NotesSession
   Dim ws As New NotesUIWorkspace
   Dim db As NotesDatabase
   Dim viewOfen As NotesView
   Dim viewMaschGruppe As NotesView
   Dim viewFelderLookup As NotesView
   Dim doc As NotesDocument
   Dim docOfen As NotesDocument
   Dim docMaschGruppe As NotesDocument
   Dim docFelderLookup As NotesDocument
   Dim listeOfen As Variant
   Dim response As Variant
   
   
   If source.IsNewDoc Then
      
      Set db = se.CurrentDatabase
      Set viewOfen = db.GetView("vwHauptKatColumn")
      Set viewMaschGruppe = db.GetView("vwUnterKatLookup")
      Set viewFelderLookup = db.GetView("vwFelderLookup")
      Set doc = source.document
      
   'Set docOfen = viewOfen.
      
   'Redim listeOfen(0) As Variant
      
      listeOfen = DBColumn(db.Server, db.FilePath, viewOfen.Name, 1)
      
      response = ws.Prompt (PROMPT_OKCANCELLIST, _
      "Haupt Kategorie", _
      "Bitte eine Haupt Kategorie auswählen.", _
      "", Arrayunique(listeOfen))
      
      If Isempty(response) Then
         Call Source.Close(True)
         Exit Sub
      End If
      
      listeMaschGruppe = DBLookup(db.Server, db.FilePath, viewMaschGruppe.name, Cstr(response), 2)
      
      response2 = ws.Prompt (PROMPT_OKCANCELLIST, _
      "Unter Kategorie", _
      "Bitte eine Unter Kategorie auswählen.", _
      "", listeMaschGruppe)
      
      If Isempty(response2) Then
         Call Source.Close(True)
         Exit Sub
      End If
      
      Call source.Document.ReplaceItemValue("HauptKat",response)
      Call source.Document.ReplaceItemValue("UnterKat",response2)
      
      Set docFelderLookup = viewFelderLookup.GetDocumentByKey(Trim(response+response2))
      
      If Not docFelderLookup Is Nothing Then
         
         Call docFelderLookup.CopyAllItems( source.Document, True )
         doc.Form = "frmOpenPoint"
      End If
      Call Source.RefreshHideFormulas
      Call Source.Refresh
      
      
      Print Source.IsNewDoc
   'Set doc = Nothing
      Set docFelderLookup = Nothing
   'Set doc = Source.Document
      
      
      Dim unid As String
      
      unid = Source.Document.UniversalID
      
      
      Source.Document.SaveOptions = "0"
      Call Source.Close(True)
   'Set Source= Nothing
      
      Call ws.EditDocument(True, doc)
      
      Source.Document.SaveOptions = "1"
      
   End If
   
   Source.Document.SaveOptions = "1"
End Sub

--- Ende Zitat ---


Das hier in eine Script-Bibliothek einfügen:

--- Zitat ---Function DBColumn(strServerName As String, strDatabase As String, strViewName As String, intColumnNumber As Integer) As Variant
   Dim NoCache As String
   Dim NotesMacro As String
   Dim Database As String
   Dim serverName As NotesName
   
   Set serverName = New NotesName(strServerName)
   
   NoCache = Chr(34) + Chr(34) + ":" + Chr(34) + "NoCache" + Chr(34)
   Database = Chr(34) + ReplaceSubstring(strDatabase,"\","\\") + Chr(34)
   
   NotesMacro = "@DbColumn(" + NoCache + ";" + Chr(34) + serverName.Abbreviated + Chr(34) + ":" + Database + ";" +_
   Chr(34) + strViewName + Chr(34) + ";" + Trim(Str(intColumnNumber)) + ")"
   
   DBColumn = Evaluate(NotesMacro)      
End Function

--- Ende Zitat ---

Roalf:
der Code sieht soweit ganz prima aus....

aber es fehlt noch das "FullTrim", sonst kann es sein, das du dir eine überflüssige Leerzeile einfängst (wenn es docs ohne Kategorieeintrag in der Ansicht gibt)

also statt
.
      response = ws.Prompt (PROMPT_OKCANCELLIST, _
      "Haupt Kategorie", _
      "Bitte eine Haupt Kategorie auswählen.", _
      "", Arrayunique(listeOfen)).
---

      response = ws.Prompt (PROMPT_OKCANCELLIST, _
      "Haupt Kategorie", _
      "Bitte eine Haupt Kategorie auswählen.", _
      "", Fulltrim(Arrayunique(listeOfen)))

brixxton:
Ja genau.  ;D

Bei mir werden keine Dokumente abgespeichert, wenn bestimmte felder nicht ausgefühlt sind.
Des wegen hatte ich es nicht in der Funktion drin.

wuwu:
Hallo brixxton,

bei mir gibt er den Fehler aus:
Illegal parenthesized reference: REPLACESUBSTRING

bei der Functionszeile ->
Database = Chr(34) + ReplaceSubstring(strDatabase,"\","\\") + Chr(34)

Warum?

Mfg Horst

Navigation

[0] Themen-Index

[#] Nächste Seite

[*] Vorherige Sete

Zur normalen Ansicht wechseln