Why don't these two VERY simple formulas evaluate to the same

Visual Basic


  • 1. Text File as DataSource
    Hi, i'm writing an application with vb.Net, including a Crystal report which uses a text file (MyFile.txt) as datasource (with an ODBC DSN). I would like to dynamically change the source to another file (MyOtherFile.txt) during runtime (it has exactly the same structure). Is it possible ? thanks Oxiane
  • 2. Linked MDB Tables
    Hi I m very new to this... My question his: I m using VB6 and Crystal 8. I have a report who works very well with my MDB, but if i have a Linked Table he doesnt work and loses all links in the report.... Can anyone help me Thanks HellGrande in Africa
  • 3. CR9 Template Expert... where in RCD ??
    I've found an extrange situation with Crystal Reports 9 From CR I can make reports and use the Reports -> Template Expert, but from VB6 and using RCD from there, this option is not visible. how can I do for access to this option from the RCD ? thanks

Re: Why don't these two VERY simple formulas evaluate to the same

Postby Bob Holmes » Thu, 24 Jun 2004 23:32:01 GMT

To change the default format for a particular type of field, see my response
to Eric Caron from 6/22/04.

Since you are combining the result of your running total field with text, to
make a complete string, your running total result can be converted to a
string and formatted:
ToText({#numericalListItemTotal}, 0, ",", "") - This will provide zero
decimal places, a comma for a thousand's separator and nothing to be used as
the decimal point.
Your formula looks as though it would print the way you describe.

Re: Why don't these two VERY simple formulas evaluate to the same

Postby Tm92aWNl » Thu, 24 Jun 2004 23:32:02 GMT

o I guess I have to do the formatting manually?

I've added the following to my formula:
StringVar numberListItemStr := ToText({#numericalListItemTotal});
Left(numberListItemStr, (Length(numberListItemStr)-3)) & ". " & {some_table.text_column}

This seems like a hack/kludge though - is this the right way to solve this?

Also, I just started writing formulas yesterday in crystal syntax and I'm having ALOT of problems finding documentation on any of the functions that are available - I basically just search google groups to determine how to use the functions from other people's postings. Is there documentation on the crystal syntax functions? Or would I be any better off using the basic syntax? I've heard that basic isn't quite as expressive as crystal - i.e. there are some things that you can do in crystal syntax that can't be done in basic.


"Novice" wrote:

Re: Why don't these two VERY simple formulas evaluate to the same

Postby Bob Holmes » Fri, 25 Jun 2004 00:49:42 GMT

Unfortunately, yes.  You'll have to do this manually.  You can set this
universally as I explained in the post which I referenced.  If you want the
number field to have zero decimal places, then the field value will be
rounded, not truncated.  In your formula, you would still use the "ToText"
function to concatenate this number with a string.

Your formula looks correct.  Sometimes they can get a little strange.

I have not come across any great references that describe all of the
functions available.  Brian Bischof's book: "Crystal Reports .NET
Programming" has several pages devoted to the functions.  He includes some
descriptions and what parameters are required.  I couldn't find anything
comparable in George Peck's: "Crystal Reports 9, The Complete Reference"

I've been using CR for five years, through several versions before Basic
Syntax was available.  I have not used Basic Syntax.  I find that I can do
everything I need using Crystal Syntax.

Similar Threads:

1.Why don't these two VERY simple formulas evaluate to the same thin

When setting the value of a variable, use a colon in front of the equal

results := true, etc.

2.Evaluating Formulas in ASP.NET

Hello everyone, I was wondering if anyone knows of a way to evaluate a
string function?  For example I have a string like "(150/50) +2" and would
like to evaluate the result in a ASP.NET webpage.  Thanks for any help.

3.Evaluate a formula

Hey, again!

How to evaluate a formula (stored in a field as "X / 60") replacing the "X" 
with a number? I replaced the "X" with a selected number but can't figure 
out how to obtain the result...

Let's say X / 60, replace X with 120, my variable contains "120 / 60". Now, 
how do I get the resulting value? EVAL (MyVar) ??


Serge O.

4.Evaluating a mathematical string formula.

Hi guys,

I am building a string in code that is a mathematical formula, based on a
lot of criteria specified by the user.  Once the formula is complete, I want
to evaluate it to get a result.  For example:

    dim strFormula as String

    strFormula = "((2 + 2) * 3) / 4) - 5"

Once I have this formula, I want to evaluate it and get the result: -2.

Any tips on how I can do this?

Also, is there a way to check if the formula is valid (i.e. I didn't miss
any parenthesis or anything)?  I guess I could try to evaluate it, and stick
it in a try - catch block.

Thanks for your time and help!


5.Evaluate formula using VBA

How can I write a VBA code to evaluate this formula 

Y = alpha*EXP(-alpha*(X-U)-EXP(-alpha(X-U)))

6. Evaluating formula in VBA

7. Evaluate text formula in VBA

8. How to Evaluate formula results in VBA

Return to Visual Basic


Who is online

Users browsing this forum: No registered users and 40 guest