1 (edited by amsjunior1 2023-07-04 23:26:01)

Topic: [SOLVED] Phone mask in table cell

I'm trying to add maskara to the column but it's not working, follow the example below that I'm trying to apply.

TNxNumberColumn(Clientes.TableGrid_Clientes.Columns[6]).FormatMask := '!\(99\) 0 0000-0000;0;_';

OBS: database mysql

2 (edited by sparrow 2023-07-03 17:43:48)

Re: [SOLVED] Phone mask in table cell

You didn't provide enough information to answer.
The code you wrote is working. Result -> !\(99\) 12 3456-7890 for number 1234567890.
maybe not what you expect but displays the result by mask.


You need to check a few things:
  The format for storing values in this column in the database
  If it's text, the mask won't work.
If it is an integer, how many characters are in the value. Pay attention to the length of the int. Max 2147483647
Way out  Form the text in the format you need as text and write it to the database as a text field.

Re: [SOLVED] Phone mask in table cell

i make select from mysql andwork perfect.

SELECT CONCAT('(', SUBSTR(celular, 1, 2), ') ', SUBSTR(celular, 3, 1), ' ', SUBSTR(celular, 4, 4), '-', SUBSTR(celular, 8, 4)) AS celular_formatado FROM tb_cliente;
Post's attachments

Attachment icon mysql_format.jpg 80.67 kb, 43 downloads since 2023-07-03 

Re: [SOLVED] Phone mask in table cell

Check your table view settings. Your SQL query is correct, returns text with formatting. Are you displaying a field named cf_celular in the table? Attach a project or a screenshot of the tabular display settings.

Визуальное программирование: блог и телеграм-канал.

Re: [SOLVED] Phone mask in table cell

example Editmask

Post's attachments

Attachment icon Mask.zip 4.28 kb, 106 downloads since 2023-07-04 

Re: [SOLVED] Phone mask in table cell

sparrow wrote:

example Editmask

Perfect example.

amsjunior1,  I will add that you can use a mask to enter data, and store the data without formatting. To do this, the mask should be like this:

!\(00\) 0 0000-0000;0;_

In this case use the capabilities of the SQL тo display with formatting.

Post's attachments

Attachment icon Mask2.rar 293.18 kb, 137 downloads since 2023-07-04 

Визуальное программирование: блог и телеграм-канал.

Re: [SOLVED] Phone mask in table cell

Thanks a lot for the help.

in the calculated field I added the script in this way and it worked

CONCAT('(', SUBSTR(Celular, 1, 2), ') ', SUBSTR(Celular, 3, 1), ' ', SUBSTR(Celular, 4, 4), '-', SUBSTR(Celular, 8, 4))   

thanks.