Home > Archive > Getting Started with dBASE > March 2006 > ALIAS WITH DATAMODULES









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author ALIAS WITH DATAMODULES
Cliff Beatty

2006-03-08, 3:23 am

I have multiple sets of dBase IV tables in a folder. The table name in each set is a five digit string plus a 3 character table type. When the program is started, the user is asked for a folder path and a client number. The character string of path plu
s client number is stored in a public variable for each table type. I issue the statement: Use "memory variable" in Select() Alias "alias name" and then Select "alias name" to process. Is it possible to use an alias with datamodules? Can one programatic
ally create datamodules? Thanks in advance for anyone's thoughts on how to set this up.
Robert Bravery

2006-03-08, 3:23 am

HI Cliff,

The short answer is yes.
But the alias would be slightly different to what youre uysed to in dbase iv
What you would do is set up a BDE database alias. Basically it is similar to
an ODBC DSN.
This would point to the appropiate folder. Then when the use logs in you
would use this alias and away you would go.
What I would do, and I do this all the time, is instead of trying to create
a datamodule progromatically, is create a basic datamodule. Then at runtime,
in you form or app or something change the database name, and activate all
objects.
something like
in dmd......
** END HEADER -- do not remove this line
//
// Generated on 03/08/2005
//
class testbgvalueDATAMODUL
E of DATAMODULE
with (this)
left = -1.0
top = -1.0
endwith

this.DBASESAMPLES1 = new DATABASE()
this.DBASESAMPLES1.parent = this
with (this.DBASESAMPLES1)
left = 19.0
top = 135.0
width = 115.0
height = 112.0
databaseName = "DBASESAMPLES" ////this is what you will change
active = true
endwith

this.FISH1 = new QUERY()
this.FISH1.parent = this
with (this.FISH1)
left = 277.0
top = 39.0
width = 114.0
height = 117.0
database = form.dbasesamples1
sql = 'Select * from "fish.dbf"'
active = true
endwith

this.SAMPLE1 = new QUERY()
this.SAMPLE1.parent = this
with (this.SAMPLE1)
left = 462.0
top = 70.0
width = 114.0
height = 117.0
database = form.dbasesamples1
sql = 'Select * from "sample.dbf"'
active = true
endwith
endclass

Now say in the forms onopen event you would do something like, assuming all
DMD is on the form:
form_onopen
form.datamodule1.active = false
form.datamodule1.fish1.active = false
form.datamodule1.sample1.active = false
form.datamodule1.databasename = mynewvariable
form.datamodule1.active = true
form.datamodule1.fish1.active = true
form.datamodule1.sample1.active = true

Just keep in mind all you databound controls, I don't know how you've set
them up
What you can also do is create identical DMD',s. Then use a datamodref in
youre form, and change the filename progromatically
I do this sometimes, in the form header with something like
if type("mdmd") ="U"
mdmd="NatPrisons.dmd"
mdmdmodule = " natprisonsdatamodule
"
endif
set procedure to &mdmd additive

There are so many different ways of aproaching this. That you have to sit
down and think which way best suits you and go for it.
Hope this helps

Robert



"Cliff Beatty" <cbeatt@consolidated.net> wrote in message
news:zSSxVklQGHA.560@news-server...
> I have multiple sets of dBase IV tables in a folder. The table name in

each set is a five digit string plus a 3 character table type. When the
program is started, the user is asked for a folder path and a client number.
The character string of path plus client number is stored in a public
variable for each table type. I issue the statement: Use "memory variable"
in Select() Alias "alias name" and then Select "alias name" to process. Is
it possible to use an alias with datamodules? Can one programatically
create datamodules? Thanks in advance for anyone's thoughts on how to set
this up.


Ken Mayer [dBVIPS]

2006-03-08, 9:23 am

Cliff Beatty wrote:
> I have multiple sets of dBase IV tables in a folder. The table name
> in each set is a five digit string plus a 3 character table type.
> When the program is started, the user is asked for a folder path and
> a client number. The character string of path plus client number is
> stored in a public variable for each table type. I issue the
> statement: Use "memory variable" in Select() Alias "alias name" and
> then Select "alias name" to process. Is it possible to use an alias
> with datamodules? Can one programatically create datamodules?
> Thanks in advance for anyone's thoughts on how to set this up.


The concept of work areas is foreign to OODML. You simply name your
query what you need, and you can have multiple instances of the same
table, multiple tables, and so on ... the alias is just a way of naming
the work area in XDML, and it's not really useful.

The term "alias" means something very different in the 32-bit software.

You don't need to use a datamodule for what you're doing. In addition,
there are many ways to do this sort of thing ...

Ken

--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/

*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/dbase/dBASEBook.htm
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase
Cliff Beatty

2006-03-09, 7:24 am

Ken Mayer [dBVIPS] Wrote:

> Cliff Beatty wrote:
>
> The concept of work areas is foreign to OODML. You simply name your
> query what you need, and you can have multiple instances of the same
> table, multiple tables, and so on ... the alias is just a way of naming
> the work area in XDML, and it's not really useful.
>
> The term "alias" means something very different in the 32-bit software.
>
> You don't need to use a datamodule for what you're doing. In addition,
> there are many ways to do this sort of thing ...
>
> Ken
>
> --
> /(Opinions expressed are purely my own, not those of dataBased
> Intelligence, Inc.)/
>
> *Ken Mayer* [dBVIPS]
> /Golden Stag Productions/
> dBASE at goldenstag dot net
> http://www.goldenstag.net/dbase/dBASEBook.htm
> http://www.goldenstag.net/GSP
> http://www.goldenstag.net/dbase

Thanks for your prompt response. The tutorials that I have studied use datamodules. I have a copy of your publication "The dBAse Book", so what chapters should I go to to learn program structiuring and coding without datamodules? Are there other publicat
ions out there that get down to the very, very basic programming steps in creating a program. I have done the tutorial thru creating forms. Are there some programs in the library that don't use datamodules?
Thanks again.
Cliff
Cliff Beatty

2006-03-09, 7:24 am

Robert Bravery Wrote:

> HI Cliff,
>
> The short answer is yes.
> But the alias would be slightly different to what youre uysed to in dbase iv
> What you would do is set up a BDE database alias. Basically it is similar to
> an ODBC DSN.
> This would point to the appropiate folder. Then when the use logs in you
> would use this alias and away you would go.
> What I would do, and I do this all the time, is instead of trying to create
> a datamodule progromatically, is create a basic datamodule. Then at runtime,
> in you form or app or something change the database name, and activate all
> objects.
> something like
> in dmd......
> ** END HEADER -- do not remove this line
> //
> // Generated on 03/08/2005
> //
> class testbgvalueDATAMODUL
E of DATAMODULE
> with (this)
> left = -1.0
> top = -1.0
> endwith
>
> this.DBASESAMPLES1 = new DATABASE()
> this.DBASESAMPLES1.parent = this
> with (this.DBASESAMPLES1)
> left = 19.0
> top = 135.0
> width = 115.0
> height = 112.0
> databaseName = "DBASESAMPLES" ////this is what you will change
> active = true
> endwith
>
> this.FISH1 = new QUERY()
> this.FISH1.parent = this
> with (this.FISH1)
> left = 277.0
> top = 39.0
> width = 114.0
> height = 117.0
> database = form.dbasesamples1
> sql = 'Select * from "fish.dbf"'
> active = true
> endwith
>
> this.SAMPLE1 = new QUERY()
> this.SAMPLE1.parent = this
> with (this.SAMPLE1)
> left = 462.0
> top = 70.0
> width = 114.0
> height = 117.0
> database = form.dbasesamples1
> sql = 'Select * from "sample.dbf"'
> active = true
> endwith
> endclass
>
> Now say in the forms onopen event you would do something like, assuming all
> DMD is on the form:
> form_onopen
> form.datamodule1.active = false
> form.datamodule1.fish1.active = false
> form.datamodule1.sample1.active = false
> form.datamodule1.databasename = mynewvariable
> form.datamodule1.active = true
> form.datamodule1.fish1.active = true
> form.datamodule1.sample1.active = true
>
> Just keep in mind all you databound controls, I don't know how you've set
> them up
> What you can also do is create identical DMD',s. Then use a datamodref in
> youre form, and change the filename progromatically
> I do this sometimes, in the form header with something like
> if type("mdmd") ="U"
> mdmd="NatPrisons.dmd"
> mdmdmodule = " natprisonsdatamodule
"
> endif
> set procedure to &mdmd additive
>
> There are so many different ways of aproaching this. That you have to sit
> down and think which way best suits you and go for it.
> Hope this helps
>
> Robert
>
>
>
> "Cliff Beatty" <cbeatt@consolidated.net> wrote in message
> news:zSSxVklQGHA.560@news-server...
> each set is a five digit string plus a 3 character table type. When the
> program is started, the user is asked for a folder path and a client number.
> The character string of path plus client number is stored in a public
> variable for each table type. I issue the statement: Use "memory variable"
> in Select() Alias "alias name" and then Select "alias name" to process. Is
> it possible to use an alias with datamodules? Can one programatically
> create datamodules? Thanks in advance for anyone's thoughts on how to set
> this up.
>

Thanks Robert. This gives me something new to study. Do you have any other ideas or sources of coding to study?
Cliff
Ken Mayer [dBVIPS]

2006-03-09, 9:23 am

Cliff Beatty wrote:
>
> Thanks for your prompt response. The tutorials that I have studied
> use datamodules. I have a copy of your publication "The dBAse Book",
> so what chapters should I go to to learn program structiuring and
> coding without datamodules? Are there other publications out there
> that get down to the very, very basic programming steps in creating a
> program. I have done the tutorial thru creating forms. Are there some
> programs in the library that don't use datamodules?


My book discusses this in the chapters on the object model and such.
Have you actually read the book? <g> It starts with programming
concepts, OOP, OODML, etc.

Ken

--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/

*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/dbase/dBASEBook.htm
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase
Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com