Problems handling DBFs and Alias

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
jparada
Posts: 430
Joined: Fri Jan 23, 2009 5:18 pm

Problems handling DBFs and Alias

Post by jparada »

Translated by Google:

I'm trying to use a browser and giving me this
problems because it can not find the Alias, do some history in
clipper to something like this:

File: Alias.PRG (define aliases that are used on the program)

Function AliasDelDbf( cDbf )
Local cAlias

cDbf := Upper( cDbf)

If cDbf == "PTVALMAC"
cAlias := "Almacen"

ElseIf cDbf == "PTVARTIC"
cAlias := "Articulos"

ElseIf cDbf == "PTVCTES"
cAlias := "Clientes"

and such Product Catalog File: Clientes.PRG

Local Attr := SaveAll( )
Local nArch := 0

BEGIN SEQUENCE

// Apertura de archivos
If ! AbrirDbfs( @nArch, { "PtvAlmac", "PtvArtic", "PtvCtes" } )
Break

Endif

This and only when I want to make a REFERENCE. DBF
just like I do: SELECT items (ie, not the alias andalusia
physical name of the DBF).

I'm trying to use this same HMG, something like this:

frmGralClientes.PRG

DEFINE WINDOW frmGralClientes ;
AT 300,05 ;
WIDTH 425 ;
HEIGHT 460 ;
TITLE "Clientes" ;
MODAL ;
ON INIT (AbrirTablas()) ;
ON RELEASE Cerrar()

Sele Clientes

@ 10,10 BROWSE oBrwClientes
HEADERS { 'Código' , 'Nombre del Cliente' } ;
WIDTHS { 100 , 350 } ;
WORKAREA Clientes ;
FIELDS { 'Clientes->f_num_cte' , 'Clientes->f_nomb_cte' } ;

And I pulled that error can not find the Alias Clientes

These functions are the same. PRG (frmGralClientes.PRG)

Function AbrirTablas()
Public nArch := 0

If ! AbrirDbfs( @nArch, { "PtvCtes", "PtvArtic", "PtvExist" } )
Break
Endif
Return

Function Cerrar( )
CerrarDbfs( nArch )
RestAll( Attr )
Return Nil

I may be doing wrong, besides I would also like to know
an idea to handle variabls as originally as you can
see clipper used as local, but if I leave Local HMG,
I mark error that can not find these variables, from time to
Public proof of claim, but I have my doubts because I have read
that is not a good idea to use Public variables, they think
and how could you solve this.

I appreciate your comments, suggestions and assistance

P.D. Forgive the length of the message, but I like to expose all
situation, and try to explain it to me like I
explained as a true freshman who is trying to use a
tool and a new way of working with her.

Greetings
Javier
jparada
Posts: 430
Joined: Fri Jan 23, 2009 5:18 pm

Re: Resolved the issue of Alias, I doubt with the variables

Post by jparada »

Because this is already the subject of Alias, but I still doubt as to the
driving variables, usually at the beginning of each clipper. PRG

To something like this:

Include "Inkey.ch"
#Include "PtvDbfs.ch"

Local GetList:={ }, Attr := SaveAll( ), nArch := 0

Private g_fol_nota, g_fech_nta, g_hora_nta

BEGIN SEQUENCE

If ! AbrirDbfs( @nArch, "PtvTxtNt", "PtvTpPgo" } )
Break

Endif

.
.
.

the rest of the code
.
.
.

And finally


RECOVER USING _Accion
If _Accion # NIL
If _Accion == REC_SALIRALDOS
SalidaRapida( )

Endif
Endif

END BEGIN

CerrarDbfs( nArch )
RestAll( Attr )

Return


That what I do in HMG, but I am giving you trouble
declared as private or local variables nArch, Attr, how can
resolve this is for the variables.

Also note the use of BEGIN SEQUENCE, here again I doubt if
this way you could do with HMG.

Thanks

Greetings
Javier
Post Reply