Bindu K
asked on
Converting Decimal number to an Integer in Crystal Reports
Hi, I have a parameter that's a number which is accepting a year (ex: 2018). But it displays as 2,018.00 when I printed on the report.
I need to pass 2018 to the database rather than 2,018.00 in Record Selection Criteria
I don't want to convert into string because my database field is smallint.
I tried truncate, Round. It is still displaying as 2,018.00
How can I make this parameter to display as 2018
Please help.
I need to pass 2018 to the database rather than 2,018.00 in Record Selection Criteria
I don't want to convert into string because my database field is smallint.
I tried truncate, Round. It is still displaying as 2,018.00
How can I make this parameter to display as 2018
Please help.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Right-click on the field in your report and select Format. In the Numbers tab, remove the decimals.
FOr display purposes you could convert it to a string or use the format option as mentioned above. I believe you can even turn the thousand separator off in the formatting.
To convert to a string for display use CStr or ToText
CStr({Yourfield},0,'')
CStr(Number to convert, # of decimal places, Thousands Separator)
mlmcc
To convert to a string for display use CStr or ToText
CStr({Yourfield},0,'')
CStr(Number to convert, # of decimal places, Thousands Separator)
mlmcc
ASKER
Thank you Raghavendra, ecarbone, mlmcc for all of your answers,
I tried CStr({Yourfield},0,'') before. But, I don't want to convert as string. This is inside formula, so I cannot do Select format-->Numbers tab etc.
I did not know that it will be passed as 2018 to the database. I was worried that it is passing 2,018.00 to the database. Thanks to Raghavendra for explaining this.
I tried CStr({Yourfield},0,'') before. But, I don't want to convert as string. This is inside formula, so I cannot do Select format-->Numbers tab etc.
I did not know that it will be passed as 2018 to the database. I was worried that it is passing 2,018.00 to the database. Thanks to Raghavendra for explaining this.