on 08-28-2009 4:41 PM
Hi.
I have a VERY simple report that all I want it to do is display the numbers from a table EXACTLY as formatted and be able to export them to Excel, as NUMBER (not STRINGS).
Example:
My fields may contains the following values in a single column:
45.02
0.04454
215
And I want them to be displayed as entered in the source table.
Initially, to maintain the formatting, I set the field's data type to a STRING.
The problem is that when I then export the data to Excel, all the numerical values are treated as TEXT and we need to "Convert Text to Numbers".
When I changed the field's data type to a DOUBLE, the data in the table is correct, but the report formats all the numbers in one way. I want to be able to retain the formatting of the field (as-is) but have them exported as numbers, rather than text.
Can this be done?
Please advise!
Thanks.
AK
Please re-post if this is still an issue or purchase a case and have a dedicated support engineer work with your directly
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I actuallly found my answer elsewhere (http://www.tek-tips.com/viewthread.cfm?qid=1235276&page=4).
The Decimal formattion (x=2) for the fields can be set as follows:
If CurrentFieldValue = Int(CurrentFieldValue) Then 0Else If CurrentFieldValue * 10 = Int(CurrentFieldValue * 10) Then 1
Else If CurrentFieldValue * 100 = Int(CurrentFieldValue * 100) Then 2
Else If CurrentFieldValue * 1000 = Int(CurrentFieldValue * 1000) Then 3
Else If CurrentFieldValue * 10000 = Int(CurrentFieldValue * 10000) Then 4
Else If CurrentFieldValue * 100000 = Int(CurrentFieldValue * 100000) Then 5
Else If CurrentFieldValue * 1000000 = Int(CurrentFieldValue * 1000000) Then 6
ElseDefaultAttribute
Basically - this works.
Hope this helps someone else!
Thanks.
AK
Before looking at CR in VB 6, can you do this in the CR designer?
Ludek
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Not sure what you mean.
In the table itself, I see the proper data (it is an Access database).
In Crystal Reports, when I select Browse data for the formula field that references that field, I see the formatted value and not the "raw data".
I only mentioned VB6 in case I needed to write some code to turn the formatting off.
All I want is for the report to display the numerical data exactly as it appears in the source table (and NOT apply any built in formatting, EVER).
Thanks!
AK
User | Count |
---|---|
87 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.