Paul,

If all you are using the second database for is addresses, I would not try
to get too fancy with joining the two databases.

Here's what I would do.  Create a NVO business rule called n_cst_address (or
whatever).  It has one primary function:

boolean of_fillAddressValues(as_id, adw_datawindow)

In your main application, whenever you have a datawindow that displays
information with addresses, you can have computed columns (in your SQL so
setItems work) on the datawindow in place of the address lines.  Then, in
retrieveEnd, have something like this:

n_cst_address    lnv_address
long                    ll_row

    ll_row = this.rowCount()
    do while ll_row > 0
        of_fillAddressValues( this.getItemString(ll_row, "id_col"), this)
        ll_row = ll_row - 1
    loop

Of course, you can make this better by:
(1)    Making n_cst_address an instance variable with an internal cache
(2)    Having the ability to update the address by checking the update
status flags and calling a function in n_cst_address
(3)    of_fillAddressValues can return False if as_id is not a valid ID.
(4)    Have the ability to dynamically name the columns in adw_datawindow so
they do not need to be hardcoded.  What I do in this case is default the
column names in my BR and provide a function to override the defaults, that
way I only need to call of_setColumnNames(...) when I have a datawindow that
differs from the norm.

Not being able to join databases could cause you problems with referential
integrity... what if I delete an address out of my address database, now all
the IDs in my other application are invalid...

I think I once heard that Oracle can have a view that crosses two distinct
databases.

D

----- Original Message -----
From: Jill M. Claus <[EMAIL PROTECTED]>
To: Klebe, Paul E. <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Monday, November 08, 1999 1:58 PM
Subject: RE: PFCSIG: Connecting to Two Databases


> Although I would find it extremely useful - I have not figured out a way
to combine information from two different databases into one datawindow.
>
> Maybe someone else in the user group may have a suggestion.  If you do get
a solution from someone addressed to your personal email address, could you
please forward it to me?  This is something I really need as well.
>
> >>> "Klebe, Paul E." <[EMAIL PROTECTED]> 11/08/99 10:15AM >>>
> Thanks. This means that although you can display information from two
> different databases in two different datawindows in a window, you cannot
> directly combine two tables from different databases on the same
> datawindow.
>
> How do you combine information from the two different databases into the
> same window? Can you use a common id column multiple times and a cached
> dropdown_datawindow to display various fields from the other database?
>
> I would like to develop a single common name-address database that is
> used throughout the commission rather than using separate tables in each
> database for our 8 divisions.
>
>
> -----Original Message-----
> From: Jill M. Claus [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, November 04, 1999 12:13 PM
> To: [EMAIL PROTECTED]
> Subject: RE: PFCSIG: Connecting to Two Databases
>
>
> Hi Paul,
>
> This is the first time I did it, so it may not be the best way... but it
> works!
> I added some comments below that may help you ...
>
> >>> "Klebe, Paul E." <[EMAIL PROTECTED]> 11/03/99 03:12PM >>>
> My name is Paul Klebe, I work for the North Dakota Public Service
> Commission. I have an upcoming project where I will be attempting to
> connect to two different databases. Would you be willing to talk to me
> about doing this. I am not getting where you are getting the connection
> to two different databases.
>
> -----Original Message-----
> From: Jill M. Claus [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, November 03, 1999 1:39 PM
> To: [EMAIL PROTECTED]
> Subject: RE: PFCSIG: Connecting to Two Databases
>
>
> I got it working - thanks everyone!
>
> For anyone curious, I changed the n_tr instance variable to be global
> and edited the application manager pfc_open event code to be:
>
> // enable transaction registration (the registration service is need
> when using more than one database)
> gnv_app.of_SetTrRegistration(TRUE)
> // register SQLCA (the connection to the first database which was
> connect to the usual way)
> gnv_app.inv_trregistration.of_Register(SQLCA)
>
> // connect to and register ABRN_MRS database (the second database)
> // create the second transaction object - note that you must have "n_tr
> gtr_amrs" identified as a global variable
> gtr_amrs = CREATE n_tr
> // copy connection info from the first database called SQLCA to the
> second database called gtr_amrs - it copies the user id, password,
> database name, server name, etc. from the definition of the first
> database connection to the definition of the second database connection
> il_return = SQLCA.of_CopyTo(gtr_amrs)
> // re-assign the database name to the second definition
> gtr_amrs.Database = "your_2nd_database_name"
> // re-assign the server name to the second definition - if it's
> different
> gtr_amrs.ServerName = "your_2nd_server_name"
> // connect to the second database
> ll_return = gtr_amrs.of_Connect()
> If ll_return <> 0 then MessageBox("Error", "Unable to connect.")
> // register the second database with the registration service
> gnv_app.inv_trregistration.of_Register(gtr_amrs)
>
> Then when ever you want to retrive data from the 2nd database, you would
> say...  (in the window's open event)
>
> li_return = dw_1.of_SetTransObject(gtr_amrs)
> dw_1.retrieve()
>
> instead of...
>
> li_return = dw_1.of_SetTransObject(SQLCA)
> dw_1.retrieve()
>
> Hope this helps!
> Jill
>
> > [EMAIL PROTECTED] HOSTED BY IIGG, INC. FOR HELP WITH LIST SERVE COMMANDS,
ADDRESS
> > A MESSAGE TO [EMAIL PROTECTED] WITH THE FOLLOWING MESSAGE:   help
pfcsig
> > SEND ALL OTHER INQUIRES TO [EMAIL PROTECTED]
>

> [EMAIL PROTECTED] HOSTED BY IIGG, INC. FOR HELP WITH LIST SERVE COMMANDS, ADDRESS
> A MESSAGE TO [EMAIL PROTECTED] WITH THE FOLLOWING MESSAGE:   help pfcsig
> SEND ALL OTHER INQUIRES TO [EMAIL PROTECTED]

Reply via email to