PDA

View Full Version : Mascara



Benedito
26-Mar-2021, 02:40 PM
Poderiam me ajudar com esta questão.

Quero que o Campo "IDENTIDADE" seja formatado assim:

Se Tipo = "F" mascara = ###.###.###-##"
Se tipo = "J" mascara = ##.###.###/####-##"

Clayton
29-Mar-2021, 06:48 AM
Object oPessoadbComboForm is a dbComboForm
Entry_Item ARQUIVO.PESSOA

Set Location to 140 70
Set Size to 12 60
Set Label to "Pessoa:"
Set Label_Col_Offset to 2
Set Label_Justification_Mode to JMode_Right
Set Entry_State to False

Procedure OnChange
Integer iPessoa

Forward Send OnChange

Get Field_Current_Value of (Server(Self)) Field ARQUIVO.PESSOA to iPessoa

Set Form_Mask of (oCpfCnpjdbForm(Self)) to (If (iPessoa=C_PessoaJuridica,'##.###.###/####-##','###.###.###-##'))
End_Procedure // OnChange
End_Object // oPessoadbComboForm

Queiroz
17-Jun-2021, 07:40 AM
Uso esta função desde os DF Caracter



//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-//
// Função Get_MASCARA
//
// Sintaxe : Move (Get_Mascara(Mascara,Fonte)) TO Destino
//
// Onde : Mascara = mascara de edicao
// : Fonte = variavel fonte
// : Destino = variavel destino (String)
//
// Exemplo : Move (Get_MASCARA("(###) ###-####",FONTE) TO DESTINO
//
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-


Function GetMascara Global String Masc# String sAux# Returns String
Local Integer iCont# iLength
Local String sLetra#
Move (fRemoveChar(sAux#)) to sAux#
Move (Length(Trim(sAux#))) to iLength
For iCont# From 1 to iLength
Move (Mid(sAux#,1,iCont#)) to sLetra#
Replace '#' In Masc# With sLetra#
Loop
Function_Return Masc#
End_Function