Function : Formula

NSFComputeEvaluate - Evaluate a formula.
----------------------------------------------------------------------------------------------------------

#include <nsfsearc.h>

STATUS LNPUBLIC NSFComputeEvaluate(
HCOMPUTE hCompute,
NOTEHANDLE hNote,
DHANDLE far *rethResult,
WORD far *retResultLength,
BOOL far *retNoteMatchesFormula,
BOOL far *retNoteShouldBeDeleted,
BOOL far *retNoteModified);

Description :

This function evaluates a compiled formula with respect to an open note. If an open note is specified, this obtains variables used in the formula from the open note and may add or modify fields in the open note.

This function provides several forms of output. If <rethResult> is provided, it returns the value resulting from evaluating the formula to the buffer. (Memory is allocated by this function call for this buffer. The caller is responsible for freeing the allocated memory by calling OSMemFree.) If <hNote> is provided, it sets new or modified fields in the open note in memory. If <retNoteMatchesFormula> is provided, it returns a boolean indicating whether the open note matches the selection portion of the formula. If <retNoteShouldBeDeleted> is provided, it returns a boolean indicating whether evaluation of the formula indicates that the open note should be deleted. If <retNoteModified> is provided, it returns a boolean indicating whether the open note was modified by evaluating the formula.

NSFComputeEvaluate requires, as input, a "compute handle" which specifies the formula to evaluate. Before calling NSFComputeEvaluate, call NSFComputeStart, specifying a compiled Domino formula, to obtain this compute handle. A single compute handle will suffice to evaluate a single formula with respect to many different notes. Thus, you may call NSFComputeStart once, then call NSFComputeEvaluate many times.

Note: NSFComputeEvaluate may execute any formula that does not include one of the following functions. These functions depend on Notes user interface functionality. Any formula that uses one of these functions will have no effect when evaluated from an API program using NSFComputeEvaluate:

   @Command
   @DbLookup
   @DbColumn
   @DDEInitiate
   @DDETerminate
   @DDEExecute
   @DDEPoke

Parameters :

Sample Usage :

 
/*
* Evaluate the formula just compiled against the note just opened.
*/

   if (sError = NSFComputeEvaluate(hCompute,
                                   hNote,
                                   (DHANDLE far *) &hResult,
                                   &wResultLen,
                                   0,
                                   0,
                                   0))
       return (ERR(sError));

   <make use of the result>

   OSMemFree (hResult);


See Also :

NSFComputeStart
----------------------------------------------------------------------------------------------------------