How to test and modify your formulas on the fly using a scanEZ shortcut
As an IBM Notes Domino developer, I have to spend a great deal of time writing, evaluating and correcting formulas for my Notes applications. Whether it’s about view/column formulas or computed text fields, working with these can turn into a tedious process. It’s a little like working away each layer of a thick wall in order to get through it when I really want to just punch through it!
Consider that even when you do have your formulas ready, you still need extensive testing to ensure that these indeed return the value you wish to see.
For instance:
- For computed fields, you would need to create a document using the form in question, and display/access the computed field results either via the UI or the Notes Properties box. Note that if you’re working on a complex formula, this process can take ages.
- When it comes to creating column formulas while working on the template instead of the production database, the lack of documents in the template may make you feel like you’re working blindfolded!
- When using the NotesSession class’s Evaluate method in LotusScript, it’s also similar to the above two scenarios except that you do not even have a formula editor window that tells you if the embedded formula is correct.
How does scanEZ help?
There’s a little known but really powerful tool inside scanEZ called the Formula Evaluator. As its name indicates, you can use this tool to evaluate formulas within a given document’s context, and edit it as you go (Fig. 1). All you need is a test document that contains all the necessary items and item values, and you’re all set!
Note: It’s important to point out that using formulas in the formula evaluation window that automatically apply changes and save the note, such as @Doclock() or @SetDocField(),will not only return the value of that formula, but will also result in the modification of the note. On the opposite end, formulas like @Thisvalue or @Thisname, which need a field context, will not work at all. In fact, they will not return anything because we are not working within a form.
Tip: In order to use this feature, you will need to have selected a document/note on the left hand side panel in scanEZ. You can also easily open a given note in scanEZ by selecting it in the Notes View and launching the tool from the toolbar. For more info on how to use the Formula Evaluator, go to our Help Page or watch a segment from a webcast recording (download it from here and go to 53:19).
Fig. 1 – Evaluate your formula by typing it in the appropriate space in the Formula Evaluator, and see the result in the box below.
What if you need to check formula results for multiple documents?
If you want to evaluate a given formula against multiple documents, simply apply the Formula Evaluator in the context of one of these documents to get your formula right, and once you’re done, you can set the display titles in a given selection using this formula. This will show whatever the formula returns as the title for all documents in your given selection (Fig. 2).
Note: The rules that were previously mentioned are also valid for evaluating a given formula against multiple documents. Formulas such as @Doclock() or @SetDocField() will result in modifying the notes while formulas like @Thisvalue or @Thisname,which need a field context, will not work at all.
Fig. 2 – Set the display titles in a given selection using your formula and display the formula results as document titles.
Tip: If you want to check multiple formulas against the same set of documents, you can use the “Values” function where you can select any item values you need for a global overview (Fig. 3). Then you can add as many custom columns as you need and you’ll be able to get the appropriate column values using the formulas you need to test. Note that you’ll need to click “Evaluate” for scanEZ to get the return values.
Fig. 3 – Check multiple formulas against the same set of documents by using the “Values” function where you can select any item values you need for a global overview.
And there you have it. Why suffer unnecessarily endlessly peeling away layers when you’ve already got the tools that can get you where you need to be in one swift hit.
Submit a comment