Domino Connection supports the use of formulas for database queries and for the use with individual documents.
Typically, there a default value formulas, input translation formula and input validation formulas connected to a form definition. You can access these formulas using the appropriate protocol with AbtLnFormField instances. When you use the default mechanism to associate a from with a document the form formulas will be executed implicitly with certain actions are performed with the note. You can, however execute formulas any time you have a valid AbtLnNote.
Formulas are compiled into some kind of byte code when they are stored in a from or a view. An AbtLnFormula has two basic elements: the formula text (as an ASCII string) and the compiled formula (as byte array). When you read a formula from a form or a view document, you initially get the byte coded formula. When you send the text message to the formula object, the byte code is decompiled, and the appropriate text string is returned. You can change the text and recompile it sending the compile message to the formula an then use the formula with a document using the computeWithNote: method. Storing formulas however is not supported.
Here is a sample that shows you how to operate a formula on a document:
| connection database formNote note formula newFormula | "Start runtime system" AbtLnEnvironment startUp. "Set up a connection to local databases" connection := AbtLnConnection local. "Open a sample databases supplied with the feature" database := connection openDatabase: 'VASAMPLE\VAFORMS'. "Open a form note named 'FormulaTest' " formNote := database formNoteByName: 'FormulaTest'. "Select the input validation formula of the fourth field" formula := (formNote allFormFields at: 4) inputValidationFormula. "Print the formula string to the transcript window" Transcript nextPutAll: formula text; cr. "Create a new formula returning the current date" newFormula := AbtLnFormula new text: '@Text(@Today)'. "Execute the formula - compile is done implicitly - and print the result to the Transcript window" Transcript nextPutAll: (newFormula computeWith: formNote) asString. "Close the database" database close. "Shut down runtime" AbtLnEnvironment shutDown.