OpenNTF.org - Formula Evaluator
My Links (Not logged in)
Code Bin Search
 
Hosted by Prominic.NET
Rate This Code
5 - brilliant stuff
4 - very nice
3 - average
2 - needs work
1 - bad
   OpenNTF Code Bin
About This Code
Brief Description:
Formula Evaluator 
Rating:
Rating: 4 , Number of votes: 1 
Contributor:
Vitezslav VLCEK 
Category:
Lotus Formula 
Type:
Debugging 
Document Release:
1.0 
Notes Version:
R6.x, R7.x 
Last Modified:
29 May 2006 
OpenNTF Disclaimer

All of the program code and information presented in the OpenNTF.org Code Bin are provided "as-is", and should be used at your own risk. OpenNTF.org make no express or implied warranty about anything in the Code Bin, and OpenNTF.org will not be responsible or liable for any damage caused by the use or misuse of anything from this site. OpenNTF.org makes no guarantees about anything. Please thoroughly test all of the knowledge and code you find here before you attempt to use them in your production environment.

Code / Description
It is formula evaluator with history. You should put this code in a smart icon.

You can use it like a simple formula debugger.

__FormulaMaxHist:=10;
__FormulaHist:="";
REM {Read his};
@For(_tmp:=1;_tmp<=__FormulaMaxHist;_tmp:=_tmp+1;
__FormulaHist:=__FormulaHist:(@Environment("FormulaEvaluator"+@Text(_tmp))));

REM {Select formula};
__FormulaHist:=@Trim(__FormulaHist);

__Formula:=@Prompt([OkCancelList]:[NoSort];"Formula evaluator";"Choose a formula:";"(new formula)";"(new formula)":__FormulaHist);
@If(__Formula="";@Return(0);__Formula="(new formula)";__Formula:="";"");

REM {edit formula};
__Formula:=@Prompt([OkCancelEdit];"Formula evaluator";"Enter a formula:";__Formula);

@If(__Formula="";@Return(0);"");

REM {Save Hist};
@If(__Formula=__FormulaHist[1];"";__FormulaHist:=@Subset(__Formula:__FormulaHist;__FormulaMaxHist));

@For(__i:=1;__i<=@Count(__FormulaHist);__i:=__i+1;@Environment("FormulaEvaluator"+@Text(__i);__FormulaHist[__i]));

REM {Eval formula};
__Result:=@Eval(__Formula);
@If(@IsError(__Result);@Return(@Prompt([Ok];"Result - ERROR";@Text(__Result)));"");
@Prompt([OkCancelEditCombo]:[NoSort];"Result";__Formula;@Text(__Result)[1];@Text(__Result))

Usage / Example
Code Attachments
FE.gif (21 Kbytes)
 Comments
Posted by Bert Haessler on 10/03/2006 03:48:34 PMnice code, try @'Debug(1) to enable the @Formula debugger
For debugging formula code you can use this script based formula debugger. It helps stepping thru the code and shows you the intermediate results and variables.
It is free to use. See www.nappz.de/xfl
Bert
 Add your comment!