user6067265
user6067265

Reputation:

Convert string to number value

From my C# code-behind I send a string value to my dataset. The data table also contains a field string type, which is dragged and dropped into Crystal Reports.

Now I need to divide that (string) value by some number, but strings can't be divided. So I need to convert the string to a value first - but I can't. No matter how I try to convert it always shows 0 on the report.


I created a formula called Euro:

NumericText({MYVALUE}) then ToNumber({MYVALUE})

And accessed it from another formula, EuroNum:

(If NumericText({Total}) then ToNumber ({Total}))

Then I created another field lets say TotalEuro where I did this in forumla, but it's always showing 0:

Euro/1.95

Upvotes: 0

Views: 349

Answers (1)

user6067265
user6067265

Reputation:

I used this formula:

If NumericText({VALUE}) Then ToNumber({VALUE}) / 1.955

Everything seems fine with Crystal Reports but I had problem in Visual Studio. Even if this file is set up to copy everytime ,file somehow not copy changes to debug folder. So I manually moved this file to debug folder and everything was fine.

Upvotes: 1

Related Questions