## Formulas switching from number to string when copied?

## Formulas switching from number to string when copied?

(OP)

I'm using CR 8.

I have several formulas that I'm copying from one report to another. All of these formulas are numeric. They represent month-to-date and year-to-date numbers at various levels of detail.

I copy and paste them one at a time. After doing so, I want to select them all and apply numeric formatting to them at the same time. The trouble is, some of them become strings instead of numbers at some point in the process of copying them. The formulas themselves haven't changed, i.e. they still return numbers. However, when I hover my mouse over them, I get the formula name plus "(string)" in the help message.

If I delete the string formulas and re-copy them, they are numeric, but now some of the formulas that were numeric to begin with have become strings.

Has anyone seen this strange behaviour or am I hallucinating?

I have several formulas that I'm copying from one report to another. All of these formulas are numeric. They represent month-to-date and year-to-date numbers at various levels of detail.

I copy and paste them one at a time. After doing so, I want to select them all and apply numeric formatting to them at the same time. The trouble is, some of them become strings instead of numbers at some point in the process of copying them. The formulas themselves haven't changed, i.e. they still return numbers. However, when I hover my mouse over them, I get the formula name plus "(string)" in the help message.

If I delete the string formulas and re-copy them, they are numeric, but now some of the formulas that were numeric to begin with have become strings.

Has anyone seen this strange behaviour or am I hallucinating?

## RE: Formulas switching from number to string when copied?

Are you copying and pasting the entire objects from one report to another, or copying the contents of the formula to the formula editor?

If you open one of these 'string' formulas, add an extra space between any two arguments (ie a change that doesn't change anything), check the formula, and resave it, does the data type become correct?

Ken Hamady

http://www.kenhamady.com/

Crystal Reports Training/Consulting and a

Quick Reference Guide to VB/Crystal (including ADO)

## RE: Formulas switching from number to string when copied?

I was copying the entire object, not just the formula text, because I was also intersted in copying the associated tool tip formula, and some conditional formatting as well.

The problem turned out to be this: The destination report did not have a parameter defined that is used by virtually every formula in this set of reports I'm working on. So the objects copied fine, but when I tried your suggestion of changing a formula by adding a space, that's when I found that the formula did not pass the error checking.

The interesting thing, and what was throwing me off, was the way each object would appear as a number and then when I tried to format it, it changed to a string. I tried this with groups of objects and with single objects.

Hope this makes some sense.

Anyway, your suggestion helped me solve my problem. Thanks