View Full Version : Formatar Cep
Benedito
30-Sep-2022, 01:12 PM
Como formatar o Cep em um relatório feito no Dataflex reports.
Fiz assim, mas não deu certo, retornou "0"
Let scep = Len({Clientes.cep})
if (sCep = 9) then
Let sCep1 = Mid({Clientes.cep),1,5,})
Let sCep2 =Mid({Clientes.pef(,6,3,})
let sCep = sCep1 + ." _" + sCep2
Return sCep
End
Fernando Faria
2-Oct-2022, 09:30 AM
Como formatar o Cep em um relatório feito no Dataflex reports.
Fiz assim, mas não deu certo, retornou "0"
Let scep = Len({Clientes.cep})
if (sCep = 9) then
Let sCep1 = Mid({Clientes.cep),1,5,})
Let sCep2 =Mid({Clientes.pef(,6,3,})
let sCep = sCep1 + ." _" + sCep2
Return sCep
End
Benedito,
Crie um campo formula e coloque o seguinte:
Picture ({TABELA.CAMPO},"XXXXX-XXX")
Fernando
Tassi
11-Oct-2022, 11:28 AM
Olá.
Tente o seguinte:
let sCEP = {cliente.CEP_NUM}
let iTam = (8-len(sCEP))
let sCompl = ""
if (iTam > 0) then
let sCompl = (String(iTam,"0"))
let sCEP = cStr(sCompl) + cStr(sCEP)
end
let sCEP1 = (Left(sCEP,5))
let sCEP2 = (Right(sCEP,3))
return sCEP1 + "-" + sCEP2
Deve funcionar tanto para campos numéricos como alfanuméricos.
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.