Lotus Notes / Domino Sonstiges > Java und .NET mit Notes/Domino
Formelsprache TO LotusScript Code-generierer schreiben
Thomas Schulte:
Oder daraus:
REM {*** begin of head ***};Title_ := "Grußformel wählen";Message := "Mit welcher Grußformel am Schluß sollen Briefe und Faxe erstellt werden?";MessageNotFound1 := "Fehler: Ein Schlüsselwortdokument für die Gruppe ";MessageNotFound2 := " wurde in der Einstellungen-Datenbank nicht gefunden.";KeyGrp := "Address Letter Close&";FieldName := "LetterClose";FieldCont := LetterClose;Tasks := "Prompt" : "PromptErrors";Language_ := Language;REM {*** end of head ***};List := "";@If(!@IsDocBeingEdited; @Command([EditDocument]); "");REM {2. build name of setup-db};ThisPathFile := @Subset(@DbName; -1);LenPathPC := @Length(@LeftBack(ThisPathFile; "\\"));LenPathMAC := @Length(@LeftBack(ThisPathFile; ":"));LenPathUNIX := @Length(@LeftBack(ThisPathFile; "/"));LenPath := @If(LenPathPC > LenPathMAC; @Max(LenPathPC; LenPathUNIX); @Max(LenPathMAC; LenPathUNIX));Path := @If(LenPath = 0; ""; @Left(ThisPathFile; LenPath + 1));KeyDB_ := @Subset(@DbName; 1) : (Path + "ge_keys.nsf");REM {X language translation because of notes bug};LanguageTrans := "";@Set("LanguageTrans"; @DbLookup(""; KeyDb_; "(KeywordsNotUTD)"; "Language"; "KeyMerge"));@Success;@If(!@IsError(LanguageTrans); ""; @Set("LanguageTrans"; @DbLookup(""; KeyDb_; "(Keywords)"; "Language"; "KeyMerge")));@Success;@Set("Language_"; @Replace(Language_; @Word(LanguageTrans; "|"; 1); @Word(LanguageTrans; "|"; 2)));REM {6. get keywords with double lookup language dependent};View2 := @If(@Ends(KeyGrp; "*"); "(KeywordsCat)"; "(Keywords)");LookType := @If(@Ends(KeyGrp; "*"); "" : "NoCache"; "");@Set("List"; "");@Set("List"; @DbLookup(LookType; KeyDb_; "(KeywordsNotUTD)"; KeyGrp + SelectionCat + Language_; "KeyMerge"));@Success;@If(!@IsError(List); ""; @Set("List"; @DbLookup(LookType; KeyDb_; View2; KeyGrp + SelectionCat + Language_; "KeyMerge")));@Success;REM {7. get keywords with double lookup language independent};@If(!@IsError(List) | (Language_ = ""); ""; @Set("List"; @DbLookup(LookType; KeyDb_; "(KeywordsNotUTD)"; KeyGrp + SelectionCat; "KeyMerge")));@Success;@If(!@IsError(List) | (Language_ = ""); ""; @Set("List"; @DbLookup(LookType; KeyDb_; View2; KeyGrp + SelectionCat; "KeyMerge")));@Success;REM {8. test error};@If(!@IsError(List); ""; Tasks = "PromptErrors"; @Prompt([Ok]; Title_; MessageNotFound1 + @Trim(KeyGrp + " " + Language_) + MessageNotFound2) + @Return(""); @Return(""));REM {9. take default list or list};Delim := @Member("--DEFDELIMITER--"; List);@Set("List"; @If(Tasks = "DefaultList"; @If(Delim > 1; @Subset(List; Delim - 1); ""); Delim < @Elements(List); @Subset(List; Delim - @Elements(List)); ""));REM {11. ask for keywords};Choice := @If(!(Tasks = "Prompt") | (@Elements(List) <= 1); List; @Prompt(@If(Tasks = "MultiValue"; [OkCancelListMult]; [OkCancelList]); Title_; Message; FieldCont; List));@If(@IsNumber(Choice); @Return(""); "");@Set("List"; Choice);REM {15. set keywords to field};@If(Tasks = "Return"; @Return(List); @SetField(FieldName; List));
flaite:
thx.
eknori (retired):
Nimm dies ;D
REM { --- this action button filters a view based on the user's input --- };
tmpVName := @Subset( @ViewTitle; -1 );
@If( tmpVName = "";
@Return( @Prompt( [Ok]; "Warning"; "This only works when a database
is opened to a view.") );
@Success );
tmpCol := 1;
REM { produce a list of categories from the current view };
tmpList := @Unique( @DbColumn( "":""; "":""; tmpVName; tmpCol ) );
REM { handle common errors -- reset filtering in an inappropriate view };
warningText := "This action only works in a categorized view where the category
is the first column." + @Char(10) +
"This will not work in a flat view or in a view where the first column is not
the category";
@If( @IsText( tmpList[1] );
@Success;
@Do( @SetViewInfo( [SetViewFilter]; ""; ""; 1); @Return( @Prompt(
[Ok]; "Warning"; warningText ) ) ) );
REM { Let the user pick one category };
tmpChoice := @Prompt( [OkCancelCombo];
"Select a Category for Filter"; "This will filter the view to a single
category." + @Char(13) + " (specify blank for all)";
""; "" : tmpList );
REM { reminder: expand the view or it may appear empty };
@Command( [ViewExpandAll] ) ;
REM { Set the filter (or clear the filter) };
tmpCName := "sPOAreaName";
@SetViewInfo( [SetViewFilter]; tmpChoice; tmpCName; 1 )
flaite:
Ich lösch die Rems (hab ich vergessen).
Aufgrund der Nachfrage, muß ich jetzt erstmal eine kleine Fileimporter-Methode schreiben (ok. nicht schwierig). Sonst muß ich die ganzen " escapen und den String zusammenschrauben.
flaite:
Ok. Leider passt der Spruch "Next batter, please" heute nicht so ganz hundertprozentig ;D
Aber ok:
Thomas erstes Skript ergab dieses Ergebnis:
EDIT: Neuer Code nachdem ich die fehlenden Formeln als Klassen hinzugefügt habe.
de.aja.formulatols.TRoot
--de.aja.formulatols.TVariable(name=_readersbaseexploded, tokenID=00000001)
----de.aja.formulatols.TFexplode
------[TUnknown: rawContent: setreaders]
------[TLiteral: rawContent: ~~]
--de.aja.formulatols.TFif
----de.aja.formulatols.TFelements
------[TVariableRef: idRef: 00000001]
----de.aja.formulatols.TFreturn
------[TLiteral: rawContent: ]
----[TLiteral: rawContent: ]
--de.aja.formulatols.TFif
----de.aja.formulatols.TFuppercase
------de.aja.formulatols.TFdblookup
--------de.aja.formulatols.TList
----------[TLiteral: rawContent: ]
----------[TLiteral: rawContent: NoCache]
--------de.aja.formulatols.TList
----------[TLiteral: rawContent: ]
----------[TLiteral: rawContent: ]
--------[TLiteral: rawContent: ($LUConfig)]
--------[TLiteral: rawContent: LOCKDOCUMENTSGENERAL]
--------[TUnknown: rawContent: 2]
--------[TUnknown: rawContent: [failsilent]]
----de.aja.formulatols.TFreturn
------[TLiteral: rawContent: ]
----[TLiteral: rawContent: ]
--de.aja.formulatols.TVariable(name=m, tokenID=00000002)
----[TUnknown: rawContent: 1]
--de.aja.formulatols.TVariable(name=_stringconcat, tokenID=00000003)
----[TLiteral: rawContent: ]
--de.aja.formulatols.TFdowhile
----de.aja.formulatols.TVariable(name=_stringlineconcat, tokenID=00000004)
------[TLiteral: rawContent: ]
----de.aja.formulatols.TVariable(name=_stringlineconcat, tokenID=00000005)
------de.aja.formulatols.TFif
--------de.aja.formulatols.TFleft
----------[TUnknown: rawContent: _readersbaseexploded[m]]
----------[TUnknown: rawContent: 1]
--------de.aja.formulatols.TFimplode
----------de.aja.formulatols.TFname
------------[TUnknown: rawContent: [canonicalize]]
------------de.aja.formulatols.TFgetfield
--------------de.aja.formulatols.TFmiddle
----------------[TUnknown: rawContent: _readersbaseexploded[m]]
----------------[TUnknown: rawContent: 1]
----------------de.aja.formulatols.TFlength
------------------[TUnknown: rawContent: _readersbaseexploded[m]]
----------[TLiteral: rawContent: ~~]
--------[TUnknown: rawContent: _readersbaseexploded[m]]
----de.aja.formulatols.TVariable(name=_stringconcat, tokenID=00000006)
------de.aja.formulatols.TFif
--------[TUnknown: rawContent: _stringconcat=""]
--------de.aja.formulatols.TFif
----------[TUnknown: rawContent: _stringlineconcat=""]
----------[TLiteral: rawContent: ]
----------[TVariableRef: idRef: 00000005]
--------de.aja.formulatols.TFif
----------[TUnknown: rawContent: _stringlineconcat=""]
----------[TVariableRef: idRef: 00000006]
----------[TUnknown: rawContent: _stringconcat+"~~"+_stringlineconcat]
----de.aja.formulatols.TVariable(name=m, tokenID=00000007)
------[TUnknown: rawContent: m+1]
----[TUnknown: rawContent: m<=@elements(_readersbaseexploded)]
--de.aja.formulatols.TFunique
----de.aja.formulatols.TFexplode
------[TVariableRef: idRef: 00000006]
------[TLiteral: rawContent: ~~]
Was mir noch aufgefallen ist:
TUnknown -> m+1,
und TUnknown m<=@elements etc. sowie relativ weit oben = 0
sowas wie [failsilent]
Sowie die Arrays.
Das packt er noch nicht.
Navigation
[0] Themen-Index
[#] Nächste Seite
[*] Vorherige Sete
Zur normalen Ansicht wechseln