Am using Crystal Reports.
A variable coming from the database, is say, 2.774,00
This is how it appears in the database. I need to convert it to ''2774'
I'm using the variable in a hyperlink, so i need a function, or combination of functions that would allow me to convert one
to the other.
The item itself is a variable, so i can use any combination to turn one, into another.
Regards,
Steve_in_Kent
Number conversion.... (Crystal Reports)
-
- 4StarLounger
- Posts: 430
- Joined: 04 Feb 2010, 11:46
Number conversion.... (Crystal Reports)
----------------------------------------------------------------------------------------
Owing at LEAST 34 beers to other helpful forum members. Especially HansV!
Owing at LEAST 34 beers to other helpful forum members. Especially HansV!
-
- Administrator
- Posts: 79897
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Number conversion.... (Crystal Reports)
Can you use the ToText function?
ToText(variable,"0")
ToText(variable,"0")
Best wishes,
Hans
Hans
-
- 4StarLounger
- Posts: 430
- Joined: 04 Feb 2010, 11:46
Re: Number conversion.... (Crystal Reports)
Yes, i tried that, and got 2.744
If i format the field, i can change the number thats shown on the screen (if i add it), and it will show 2774. however, internally, the number its holding
is 2.774,00
so when i use it in the hyperlink field, its eg: "www.fred.com/itemid=2.774,00"
which doesn't resolve properly, in the database that im linking to.
If i format the field, i can change the number thats shown on the screen (if i add it), and it will show 2774. however, internally, the number its holding
is 2.774,00
so when i use it in the hyperlink field, its eg: "www.fred.com/itemid=2.774,00"
which doesn't resolve properly, in the database that im linking to.
----------------------------------------------------------------------------------------
Owing at LEAST 34 beers to other helpful forum members. Especially HansV!
Owing at LEAST 34 beers to other helpful forum members. Especially HansV!
-
- Administrator
- Posts: 79897
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Number conversion.... (Crystal Reports)
I don't know anything about Crystal Reports, but have you made sure that the variable you assign ToText(variable,"0") to is a string variable? If it is a numeric variable, the ToText will not help.
E.g.
...
Dim variable2 As String
variable2 = ToText(variable,"0")
...
E.g.
...
Dim variable2 As String
variable2 = ToText(variable,"0")
...
Best wishes,
Hans
Hans
-
- 4StarLounger
- Posts: 430
- Joined: 04 Feb 2010, 11:46
Re: Number conversion.... (Crystal Reports)
Yes, unfortunately there is nothing i can do with the 2.774,00 . its a number variable. Its not something that i can alter. It comes from the database.
Its a most bizarre way of holding a number, i must say.
edit: ahh i see what you mean..
however, i too have no experience of using basic, in a crystal variable.
researching now....
Its a most bizarre way of holding a number, i must say.
edit: ahh i see what you mean..
however, i too have no experience of using basic, in a crystal variable.
researching now....
Last edited by Steve_in_Kent on 08 Feb 2010, 13:36, edited 1 time in total.
----------------------------------------------------------------------------------------
Owing at LEAST 34 beers to other helpful forum members. Especially HansV!
Owing at LEAST 34 beers to other helpful forum members. Especially HansV!
-
- Administrator
- Posts: 79897
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Number conversion.... (Crystal Reports)
Could you explain how you assemble the hyperlink? Do you use code, and if so, could you post a bit more of the code?
Best wishes,
Hans
Hans
-
- 4StarLounger
- Posts: 430
- Joined: 04 Feb 2010, 11:46
Re: Number conversion.... (Crystal Reports)
yes, the code is just a hyperlink formula that you can put in Crystal Reports, with the last part being added as a variable..
eg:
"http://us6petqa01.na.cokecce.com:9081/r ... KEY_VALUE=" & {@Test}
The @test, is the variable that i'm trying to assign the number 1774 to. but in the database, i query a field that has the individual item i want to link to, that is held as a number, (the 1.774,00)
eg:
"http://us6petqa01.na.cokecce.com:9081/r ... KEY_VALUE=" & {@Test}
The @test, is the variable that i'm trying to assign the number 1774 to. but in the database, i query a field that has the individual item i want to link to, that is held as a number, (the 1.774,00)
----------------------------------------------------------------------------------------
Owing at LEAST 34 beers to other helpful forum members. Especially HansV!
Owing at LEAST 34 beers to other helpful forum members. Especially HansV!
-
- Administrator
- Posts: 79897
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Number conversion.... (Crystal Reports)
I assume that you have tried
"http://us6petqa01.na.cokecce.com:9081/r ... KEY_VALUE=" & ToText({@Test},"0")
You might also try
"http://us6petqa01.na.cokecce.com:9081/r ... KEY_VALUE=" & ToText({@Test},"0000")
"http://us6petqa01.na.cokecce.com:9081/r ... KEY_VALUE=" & ToText({@Test},"0")
You might also try
"http://us6petqa01.na.cokecce.com:9081/r ... KEY_VALUE=" & ToText({@Test},"0000")
Best wishes,
Hans
Hans
-
- 4StarLounger
- Posts: 430
- Joined: 04 Feb 2010, 11:46
Re: Number conversion.... (Crystal Reports)
Yes, tried those, for some reason it generates an error, too many functions.
----------------------------------------------------------------------------------------
Owing at LEAST 34 beers to other helpful forum members. Especially HansV!
Owing at LEAST 34 beers to other helpful forum members. Especially HansV!
-
- 4StarLounger
- Posts: 430
- Joined: 04 Feb 2010, 11:46
Re: Number conversion.... (Crystal Reports)
Update:-
Setting the @Test variable to TOTEXT({var},"0000")
does generate the 4 digit number, that hyperlinks correctly.. however. the variable could be 3 or 5 characters, in which case it
then fails, because its generating, eg: for 01774
Setting the @Test variable to TOTEXT({var},"0000")
does generate the 4 digit number, that hyperlinks correctly.. however. the variable could be 3 or 5 characters, in which case it
then fails, because its generating, eg: for 01774
----------------------------------------------------------------------------------------
Owing at LEAST 34 beers to other helpful forum members. Especially HansV!
Owing at LEAST 34 beers to other helpful forum members. Especially HansV!
-
- Administrator
- Posts: 79897
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Number conversion.... (Crystal Reports)
What happens if you set @Test to CStr({var},"#") or to CStr({var},"0") ?
Best wishes,
Hans
Hans
-
- StarLounger
- Posts: 80
- Joined: 24 Jan 2010, 13:09
- Location: Brantford, Ontario, Canada
Re: Number conversion.... (Crystal Reports)
Is there a reason that the database can't hold the numeric value in the desired format?
Is it possible to create a data view or table containing the desired format?
I'm a novice Crystal Reports developer at work. Anytime I've required data to be formatted differently, I've been lucky enough to have the DBA work with me to get the data in a friendlier format.
Is it possible to create a data view or table containing the desired format?
I'm a novice Crystal Reports developer at work. Anytime I've required data to be formatted differently, I've been lucky enough to have the DBA work with me to get the data in a friendlier format.
-
- 4StarLounger
- Posts: 430
- Joined: 04 Feb 2010, 11:46
Re: Number conversion.... (Crystal Reports)
Unfortunately, the people running the database, are useless, to say the least.. There is no work done on the back end at all. impossible to get anything changed.
I'm going to play around with it a bit more in the next few days, i have another problem to solve with access right now.
It looks as though it can be done though, even if i need a bunch of if then,,, statements in a variable. it looks like its doable..
Steve
I'm going to play around with it a bit more in the next few days, i have another problem to solve with access right now.
It looks as though it can be done though, even if i need a bunch of if then,,, statements in a variable. it looks like its doable..
Steve
----------------------------------------------------------------------------------------
Owing at LEAST 34 beers to other helpful forum members. Especially HansV!
Owing at LEAST 34 beers to other helpful forum members. Especially HansV!