Das Notes Forum
Domino 9 und frühere Versionen => ND6: Entwicklung => Thema gestartet von: schlissm am 10.11.04 - 21:12:32
-
Hallo,
...ich mal wieder ....
hab eine Maske ... in dieser kann ich über ein Dialogfeld auswählen um welchen "Typ" es sich handelt. Je nachdem welcher Typ gewählt ist sollen entsprechende Teilmasken eingeblendet werden.
also hab ich eine berechnete Teilmaske eingefügt.
Die Formel lautet :
@If(type= "PC";"hard_GeneralInfo";"")
Teilmaske heisst : hard_GernalInfo
jetzt starte ich die maske und wähle den "Type" aus ... nur leider zeigt er mir die maske nciht an ... wie mach ich das am geschicktesten ?
bei dem Dialogfeld sind alle Häckchen gesetzt bei aktualisieren ...
Danke schon mal
-
Das geht so nicht. Teilmasken werden nur beim Laden der Maske berechnet und geladen, sobald Du die Maske siehst und aufüllen kannst, ist es schon zu spät. Da musst Du eher mit versteckten Bereichen arbeiten.
-
Stimmt genau, was Jens sagt.
Alternativ könntest Du noch beim Erstellen eines Dokumentes eine Auswahl bringen.
Dazu setzt Du eine entsprechende Formel in ein berechnetes Feld mit einem @Prompt([OkCancelList]...) und schreibst in das Feld das Ergebnis rein.
In der Formel für die Subform beziehst Du Dich dann auf den Feldinhalt des Feldes.
2. Alternative: Ein Reopen des Dokumentes programmatisch erzeugen.
-
Ist das Dokument (da kann es ja Gründe geben) doch schon geöffnet, kann man auch noch den Namen der gewählen Subform im Dokument speichern, das Dokument dann zufallen lassen und erneut öffnen. Das ist auch ein probates Mittel, geht aber nur in LS.
Bernhard
-
Genau Bernhard, das meinte ich mit "Reopen", aber Du hast das schöner erklärt :D
-
hallo,
bin zwar selbst kein profi aber vielleicht kann ich helfen.
es sollte funktionieren wenn du das dokument speicherst und sofort wieder aufrufst.
folgendes hab ich (glaub sogar hier im forum) gefunden:
Hi, kann dir nur sagen das RitchText Felder in Notes erst beim Speichern angelegt werden und somit dann erst den Inhalt anzeigen.
Du musst einfach uidoc Speichern -> schliessen -> wieder öffen in das Script einbauen.
Code:
.....
Set obj_CurrentDocument = uidoc.Document
.....
Call obj_CurrentDocument.Save(True, True)
Call uidoc.close
Set uidoc = workspace.EditDocument(True,obj_CurrentDocument)
dann gibts es auf der webside von anton tauscher noch ein script was genau das macht.
http://www.anton-tauscher.de
script als rtf-dokument lade ich mit hoch. hab es aber nie ausprobiert.
gruß martin
-
Das Ganze lässt sich auch realisieren, ohne das Dokument speichern zu müssen.
Grundidee:
1. backendoc wird erstellt
2. das zughörige uidoc wird geöffnet
3. der Wert des Feldes, welches die berechnete Teilmaske definiert wird vom User (bspw. via Dialog) geändert
4. das uidoc wird wieder geschlossen (passiert aber erst, wenn der Code fertig ausgeführt wurde)
5. ein neues uidoc wird basierend auf dem backendoc (noch im memory) geöffnet
6. die referenz von backendoc zum alten uidoc wird gelöscht
7. dem backendoc wird das document property des neuen uidoc zugewiesen...
Tönt relativ abgefahren, funktioniert aber ganz gut.
Hier der ScriptCode...
Sub insertSubform(strSubformposition As String)
'modify a rich text field or the selection for a computed subform WITHOUT having to save and re-open the document
'The basic idea:
'1. creation of a backend-document
'2. open the correspondig uidoc
'3. close uidoc (will not happen until the code is finished executing
'4. open a new uidoc based on the backend-document that is still in memory
'5. delete the reference of the backend-document to the old uidoc
'6. assign the document property of the new uidoc to the backen-document
'-> with this procedure it is possible to load subforms without having to save > close > reopen the document
'arguments: strSubformposition: Top | Bottom
Const FORM = "Vorlage"
Dim session As NotesSession
Dim ws As NotesUIWorkspace
Dim db As NotesDatabase
Dim uidocOld As NotesUIDocument 'the original instance of the uidoc
Dim uidocNew As NotesUIDocument 'the new instance of the uidoc
Dim docThis As NotesDocument
Dim strSubform As String
Set session = New NotesSession
Set ws = New NotesUIWorkspace
Set db = session.CurrentDatabase
Set uidocOld = ws.CurrentDocument
Set docThis = uidocOld.document
docThis.Form = FORM
'find all available subforms in this db
Const TITLE = "title"
Const PROMPT = "prompt"
Dim strSubFormsArray() As String
Dim varSubForms As Variant
Dim intJ As Integer
varSubForms = dbDesign.subformDocuments
Redim strSubFormsArray(Ubound(varSubForms)) As String
Forall varK In varSubForms
strSubFormsArray(intJ) = varSubForms(intJ).~$TITLE(0)
intJ = intJ + 1
End Forall
strSubform = ws.Prompt( PROMPT_OKCANCELCOMBO, TITLE, PROMPT, strSubFormsArray(0), strSubFormsArray )
If strSubformPosition = "Top" Then
'make sure the subform can not be used twice
If docThis.SubformBottom(0) <> strSubform Then
docThis.SubormTop = strSubform
Else
Exit Sub
End If
docThis.SubformTop = strSubform
Elseif strSubformPosition = "Bottom" Then
'make sure the subform can not be used twice
If docThis.SubformTop(0) <> strSubform Then
docThis.SubformBottom = strSubform
Else
Exit Sub
End If
End If
'prevent user form beeing asked to save document
docThis.SaveOptions = "0"
'close uidoc. it won't actually happen until the code is finished executing
Call uidocOld.Close(True)
'create a new uidoc and open the backend doc that is still in memory
Set uidocNew = ws.EditDocument(True, docThis)
'delete the reference to uidocOld
'this is necessary because the code below affects it if left in memory
Set docThis = uidocNew.Document
'remove the saveoptions field
docThis.RemoveItem("SaveOptions")
End Sub
Gruss
Ray
-
hallo,
wollte mich noch mal bei euch für die vielen echt hilfreichen lösungsvorschläge bedanken ...
leider konnte ich in letzter zeit aus der firma nichts in dieses forum posten ... kam immer ein zeitüberlauf ... deswegen hatte ich das hier schon fast vergessen...
hab es jetzt einfach über die ausblenden funktionen des textes gemacht ...
cu
schlissm