Crystal Report > formater un numéro de téléphone en utilisant le format de la table Pays

SOLVED

Bonjour,

L'utilisation de la fonction Picture doit le permettre, mais je ne connais pas la syntaxe exacte.

Merci

  • +1
    verified answer

    bonjour,

    formule de cpy_indicatif:

    global stringVar format;

    format := {TABCOUNTRY.TELFMT_0};
    format := Replace (format,"[","");
    format := Replace (format,"]","");
    format := Replace (format,"8#","xxxxxxxx");
    format := Replace (format,"9#","xxxxxxxxx");
    format := Replace (format,"10#","xxxxxxxxxx");
    format := Replace (format,"11#","xxxxxxxxxxx");
    format := Replace (format,"12#","xxxxxxxxxxxx");
    format := Replace (format,"13#","xxxxxxxxxxxxx");
    format := Replace (format,"14#","xxxxxxxxxxxxxx");

    et formule de la zone téléphone formatée:

    picture({BPADDRESS_REP.TEL_0},{@cpy_indicatif})

  • 0 in reply to LIAUD

    Bonjour,  merci, je vais essayer.

  • +1
    verified answer

    Bonjour,

    J'ai eu la même demande récemment et j'ai trouvé ceci sur le NET

    Créer une fonction personnalisée dans Crystal Report FRMTEL

    Function FRMTEL (FRM As String, NUM As String, PREFIXFR as boolean )
        Dim a as number
        Dim p as number
        Dim z as number
        Dim x as number
        Dim lngf as number
        Dim lngn as number
        Dim c as String
        Dim PREFIX as string
        Dim SEPARATEUR as string
        Dim V as string
        Dim TELFRMP as string
        if FRM="" then 
            FRMTEL=NUM
        elseif NUM<>"" then
            if PREFIXFR then PREFIX="+33" else PREFIX=""
            lngn=len(NUM)
            lngf=len(FRM)
            TELFRMP="" : c="" : V="" : SEPARATEUR=""
            for a=1 to lngf
                c=Mid(FRM,a ,1 )
                Select Case c
                Case "["
                    z=instr(a,FRM,"]")
                    if a=1 then
                        PREFIX = mid(FRM,a+1,z-(a+1))
                    else
                        SEPARATEUR=left(mid(FRM,a+1,z-(a+1)),1)
                    end if
                    a=z
                Case "0","1","2","3","4","5","6","7","8","9"
                    V=V+c
                Case "#", "X" 
                    if V<>"" then
                        if PREFIX="+33" and TELFRMP="" and mid(NUM,p+1,1)="0" then
                            TELFRMP="(0)"    
                            For x=p+2 to p+val(V)
                                TELFRMP=TELFRMP+mid(NUM,x,1)    
                            next x
                            p=val(V)
                            V=""
                        else
                            TELFRMP=TELFRMP+iif(TELFRMP<>"",SEPARATEUR,"")+mid(NUM,p+1,val(V))
                            p=p+val(V)
                            V=""
                        end if
                    end if
                End Select
            next a
            FRMTEL=PREFIX+TELFRMP
        else
            FRMTEL=""
        end if
    End Function

    FRM pour le format, récupéré dans la table pays (TABCOUNTRY.TELFMT_0)

    NUM pour le numéro de téléphone. Il ne doit pas être formaté lors de la saisie dans SAGE X3

    PREFIXFR pour indiquer si le numéro commence par +33 (0)

    Cela fonctionne très bien.

    Bon dev'

  • 0 in reply to JCh.BDL

    Bonjour, un grand merci, je vais essayer ça.