I'm trying to format data in a record box, I have a field in my data called PrimaryPhone that returns the data without any dashes and I want the data to display as 000-000-0000. I have tried this in the field property and also the dataformat property with no luck
Format(PrimaryPhone,"000-000-0000"). what is the correct way to make this work and which property to I put it in. I also have some date fields that I need to format and I've tried with no luck.
Formatting Data
Re: Formatting Data
Support · Aug 20, 2008Hello,
You can get the phone number in this format using the RecordBox report element. Following is the format to use in the DataFormat property of the RecordBox: "###-###-####".
Thanks,
ceTe Software Support Team
Re: Formatting Data
Forum member · Aug 20, 2008I've put "###-###-####" in the dataformat property and it still isn't formatting
Re: Formatting Data
Support · Aug 20, 2008Hello,
Can you please send over the dplx file which you are using to generate the report and the output pdf file to our [^a|mailto:support@cete.com|Support Team^] so that they can have look into it further?
What is the input format of the string that gets passed to the format function?
Thanks,
ceTe Software Support Team
Re: Formatting Data
Forum member · Nov 21, 2008I'm trying to accomplish the same thing. What was the solution to this? My data is being passed as one long string such as 4165551212 and I would like to format it as 416-555-1212. I've added the DataFormat as ###-###-####, but the result is still the full string without dashes.
Thanks in advance.
Re: Formatting Data
Forum member · Nov 21, 2008Here is part of an email I recieved from them.
The dataFormat string can only be applied to numeric values so the varchar values being returned will not work directly. All you will need to do to accomplish this is convert your varchar values to a numeric value. Make sure that your numeric value type supports numbers big enough for your intended use. In other words the phone number (10 digits) will likely need to be converted to a "bigint" while the date value (8 digits) can likely be converted to just an "int".
So you have to convert the number to an int then you can use the DataFormat property of a record box. Or you have to format it on the back end before you use it which is what I did.
Re: Formatting Data
Forum member · Nov 21, 2008Yep, that did it! In my stored procedure, I just wrapped the field in a convert(bigint,<phone number>) and the record box dataformat rendered as expected with the dashes.
Great response. Thank you very much!