cancel
Showing results for 
Search instead for 
Did you mean: 

Formating Problems using CSTR Function

Former Member
0 Kudos

Hi,

i am using the following formula to search and publish values within crystal Reports using a collector:

This is the coding which works fine with normal numbers:

select{HQ_HMCOPA01_ERG3_BOCRE.Abweichungen COPA BOCRE}

case "Abweichung zum Vorjahr %" : (

s_8 :=           cStr(Round(Val({HQ_HMCOPA01_ERG3_BOCRE.01. Umsatz})),0)

)

default : dummy := "0"

;

{HQ_HMCOPA01_ERG3_BOCRE.Abweichungen COPA BOCRE};

The above mentioned formula has also been used to round up a percentage value.

In BEX it looks like this "screenshot 1":

The original percentage number has been formated within the Query and rounded.

-191,077546761 will be 191,1

This is the result that I need in Crystal as well.

In Crystal I get the following number:   -191.077546761 (it sets an . instead of an ,

So if i use my function above the result will be "screenshot 2"

Any ideas?

Thanks for your help

Accepted Solutions (0)

Answers (1)

Answers (1)

JWiseman
Active Contributor
0 Kudos

hi Angelo,

if you use something like

totext({HQ_HMCOPA01_ERG3_BOCRE.Abweichungen COPA BOCRE},1,'#,###.##',',')

you should get the desired result.

the online help for totext has a description of all the parameters of the totext function.

cheers,

jamie

Former Member
0 Kudos

Hi Jamie,

good guess. I tried it out but I got an errormessage:

The function call doesn't match the overload of totext.

My programming knowledge is more than Basic... 🙂

Is the formula correct like this´, or do I have to Change something?

abhilash_kumar
Active Contributor
0 Kudos

Hi Angelo,

Could you try just this:

totext({HQ_HMCOPA01_ERG3_BOCRE.Abweichungen COPA BOCRE},1,",")

-Abhilash

Former Member
0 Kudos

Hi, I tried it out but still get errormessage.

Is there something wrong with my other coding?

Attached I have explained everything I did.

Please follow Picture 1-4

I really have no clue why it is not working....

JWiseman
Active Contributor
0 Kudos

a couple of things that could be going wrong:

1) if you're creating a case statement or an if then else statement, the output types of each case must match...i.e. in your case they must all be string type

2) you can't use totext on a string...you can use tonumber on a string and then totext it afterwards though

if the above doesn't fix it, we'd really need to the exact error produced as well as the data that caused the error.