Changing a character field to numeric
Moderators: Moderators, Tech Support
Changing a character field to numeric
I am doing a custom report in CONTRIBUTIONS. Because of a site specific reason, I am using FAMILY PHONE 3 to contain price information (ex 100.00). In my CONTRIBUTIONS custom report I would like to subtract CONTRIBUTIONS AMOUNT from FAMILY PHONE 3. I cant do this because FAMILY PHONE 3 is a character field. Is there a way to convert this to a numeric field just for my subtraction process?
-
- Tech Support
- Posts: 3015
- Joined: Thu May 13, 2004 9:59 am
- Location: PowerChurch Software
- Contact:
Re: Changing a character field to numeric
You can use CAST() to change a character to a number. Your expression would look something like this:
This will subtract the contribution amount from whatever number you have in family phone 3. Luckily, if some value in phone 3 is not able to be cast to a number, it will simply be zero rather than blowing up your report.
Code: Select all
CAST(phone3 AS N(8,2))-amount