Topic: Fast Report Phone #

Hi all,

I have a field in MVD that is formatted as a phone nbr (999)999-9999
The actual mask is !\(999\)000-0000;0;_
-
This works fine in my forms, however when I use this field in Fast Report, the formatting does not show up,
just the numbers 1112223333
-
Does anyone know how to make the phone format show up in Fast Report?
-
Thanks, Frank

2 (edited by derek 2020-08-27 11:34:30)

Re: Fast Report Phone #

Hi Frank,
When MVD saves the phone number,  it is saved 'raw' - the formatting is only applied when you run your program (see screenshot 1) but the formatting doesn't carry over in to FastReport.
There are a couple of options but for me, the easiest (and therefore the best (LOL!)) would be a calculated field which can be taken across to the report.
It has the added advantage in that you can also use the calculated field to display in your tablegrid so you see the phone with its formatting there as well.
Please see the attached as an example.
Derek.

Post's attachments

Attachment icon frank phone.zip 432.14 kb, 210 downloads since 2020-08-27 

Re: Fast Report Phone #

Derek,

I'm trying to add the Calculated field to my program and I'm having some trouble.  I'm guessing it has something to do with relationships maybe?
-
My main table is Users. It has a field called CellPhone
-
I have another table called Contacts. It has a field called cCellPhone.
-
Contacts is related to Users.
-
When I add the Calculated Phone Number field calcCellPhone to Users, I get an error saying that it can't find Phone.
-
I've attached a screen shot of the ERROR Message and the SQL error.
-
Any thoughts?
Thanks, Frank

Post's attachments

Attachment icon MVD Error Messge.png 9.56 kb, 95 downloads since 2020-08-29 

Re: Fast Report Phone #

Derek,

Here's the SQL error message. I could only add one file to my last message.

Thanks,
Frank

Post's attachments

Attachment icon MVD-SQL-message.png 10.57 kb, 93 downloads since 2020-08-29 

5 (edited by brian.zaballa 2020-08-29 01:25:12)

Re: Fast Report Phone #

I think you need to put the calculated on Contacts table and use the cCellPhone. But why you have to put CellPhone field on Users and have children Contacts? If your database design is a user having one or more contacts, Contacts table as children is enough.

Post's attachments

Attachment icon frank phone - children.zip 591.16 kb, 220 downloads since 2020-08-29 

brian

Re: Fast Report Phone #

Brian,
Thanks for your reply
-
I added a calculated field named calcCellPhone to the Contacts table.  When I go to open up the Contacts Form I still get the same error.
-
FYI I also have a cell phone field in the Users table so eventually I would like to format that field like the calcCellPhone in the contacts table.
-
From my trial and error it appears that if I add a new calculated field to either Users or Contacts it fails.  Even if I don't do anything with the new field.  Just adding it to an existing table makes it fail.
-
I have a lot of test data in my tables.  Could that have any impact on adding a new field?
-
Thanks, Frank

7 (edited by papafrankc 2020-08-29 03:35:31)

Re: Fast Report Phone #

Brian, Derek
I believe I have found my problem.
-
I was using the calculated field that Derek provided as is.  That is I was calculating on the field phone.
-
However the name of my cell phone field in Contacts is cCellPhone.
-
I changed the calculated field script to use my existing field and I stopped getting the error.  I think I can get rid of the cCellPhone field and just use the calcCellPhone field.  I'm going to play with that some more.
-

I love MVD, but if I miss one little step, I can get in trouble smile
-
Thanks for helping me to figure it out.

8 (edited by brian.zaballa 2020-08-29 03:40:04)

Re: Fast Report Phone #

papafrankc wrote:

Brian,
Thanks for your reply
-
I added a calculated field named calcCellPhone to the Contacts table.  When I go to open up the Contacts Form I still get the same error.
-
FYI I also have a cell phone field in the Users table so eventually I would like to format that field like the calcCellPhone in the contacts table.
-
From my trial and error it appears that if I add a new calculated field to either Users or Contacts it fails.  Even if I don't do anything with the new field.  Just adding it to an existing table makes it fail.
-
I have a lot of test data in my tables.  Could that have any impact on adding a new field?
-
Thanks, Frank

If you copy the calculated Derek and I used, we use phone there for it is the field on our database. on User for Derek. on Contacts for me. You need to replace it of the field on your table. in your case,  change phone from User's calculated to CellPhone and change phone from the Contact's calcCellPhone to cCellPhone.

For User, something like

'('||substr(CellPhone,1,3)||')'||substr(CellPhone,4,3)||'-'||substr(CellPhone,7,4)

and for Contacts

'('||substr(cCellPhone,1,3)||')'||substr(cCellPhone,4,3)||'-'||substr(cCellPhone,7,4)

Adding calculated fields or other fields won't affect your current data. MVD will automatically populate the table with your existing records

brian

Re: Fast Report Phone #

*********** Update
I just checked and it looks like I need to keep the cCellPhone field and just add the calcCellPhone field and have this field do the calculations on cCellPhone
**************
Thanks, Frank

Re: Fast Report Phone #

papafrankc wrote:

*********** Update
I just checked and it looks like I need to keep the cCellPhone field and just add the calcCellPhone field and have this field do the calculations on cCellPhone
**************

Hi Frank,
You absolutely need to keep 'ccellphone' .  Calculated fields don't actually get stored in any table - they are temporary and only exist while the program is running.  As such, they have to relate to an actual field (or fields) - in your example, if you don't keep 'ccellphone', then 'calccellphone' has nothing to be based on.
Derek.