non-string constants?

Hello; Is it possible to create non-string constants? Ex: const PI = 3.14? My understanding is that it is not possible in Navision. My workaround will be to implement certain commonly used numbers as return values from functions in a codeunit. This isn’t ideal because the value returned can be modified. Is this what other people are doing? Brian.

You can make a function like this: PI() (return value myVal:decimal) EXIT(3.14) Bye

You could also try: evaluate(MyReturnValue,TextConstant); exit(MyReturnValue); Bill Benefiel Manager of Information Systems Overhead Door Company billb@ohdindy.com (317) 842-7444 ext 117

I’m curious what applications you are developing that require this. Normally, it is not necessary to have numeric constants in Navision. Numeric values are almost always stored in the database so that the user can change them as necessary. Your example of PI is a good one. Did you know that about 100 years ago the Indiana state legislature nearly passed a bill making the value of pi= 3.00? Well, you need to have values like this in the database so they can be easily changed. Jim Hollcraft NCSD, NCSP, MCSE, CNE, MCP, MST aka Skater http://drilldot.com Unauthorized Navision News

quote:


Originally posted by wbenefiel: You could also try: evaluate(MyReturnValue,TextConstant); exit(MyReturnValue);


Evaluate would return an error if the wrong string was passed so IF EVALUATE(MyReturnValue,TextConstant)THEN EXIT(MyReturnValue) ELSE EXIT(0); But to answer the original question you cannot set constants you can only return them from a function: I would Pass a string to the Function use a case statement and return a decimal: David Cox MindSource (UK) Limited Navision Solutions Partner Email: david@mindsource.co.uk Web: www.mindsource.co.uk Edited by - David Cox on 2001 Jun 06 17:51:05

Based on my understanding of the question, I didn’t feel the need to capture the returned boolean value. The very nature of a Text CONSTANT is that the value stays the same, thus it should always evalute. If it doesn’t evaluate, then perhaps the error is exactly what we want! Bill Benefiel Manager of Information Systems Overhead Door Company billb@ohdindy.com (317) 842-7444 ext 117