retreive from datawindow

Hi
I have dw_1 and dw_2. I have populated dw_1 with owner_id. If I click any one owner_id , I want the details of all that owner_id in dw_2. How can I achieve it ?

I created dw_1 and associated with owner table and I can see owner_id displayed too. When I click any owner_id , I have a message box to display the correct owner_id.

Now where shd I write code for displaying the owner details is dw_2 ? How shd I create dw_2 ??

Thx
M
mahalakshmi_sAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

gajender_99Commented:
Here is the simple way

//go to the rowfocuschanged event of dw_1

long vl_ownerid

vl_ownerid=dw_1.getitemnumber(row,"owner_id")
dw_2.retrieve(vl_ownerid)

This will alwasys retriev the details for dw_2 depending upon the owner_id from dw_1

also dont forget to write the code  where you have the script for retrieving the data for dw_1

dw_1.retrieve()
dw_1.triggerevent(rowfocuschanged!)


hope this will help you

Gajender Singh
mahalakshmi_sAuthor Commented:
I get ERROR.
undefined variable 'row'

Also, I havent coded to retrieve dw_1. Whenever I created , the dataobject fetches data from db.
mahalakshmi_sAuthor Commented:
I rectified by using

vl_ownerid=dw_master.getitemnumber(dw_master.GetRow(),"owner_id")

well , I get error:

Database transaction not available, Call SetTrans Object or SetTransObject function
Fundamentals of JavaScript

Learn the fundamentals of the popular programming language JavaScript so that you can explore the realm of web development.

mahalakshmi_sAuthor Commented:
how shd I create dw_2 ? do i need to specify any Retreival arguments ? explain pls !
gajender_99Commented:

vl_ownerid=dw_master.getitemnumber(dw_master.GetRow(),"owner_id")
dw_2.settransobject(SQLCA)
dw_2.retrieve(vl_ownerid)


Gajender
mahalakshmi_sAuthor Commented:
G,
Still  , I get error:

Database transaction not available, Call SetTrans Object or SetTransObject function

I feel I have done something wrong in creating dw_2.
I created like

File-new-datawindow-freeform-quick select-selected all columns. Specified Retrieval arg.Saved as d_details. In my window I created Insert-Datawindow Control n selected d_details as dataobject.
mahalakshmi_sAuthor Commented:
"Cannot connect to database DBMS is not supported by your current installation"
is the error mesg when I use like this :

CONNECT USING SQLCA;

// Test whether the connect succeeded.

IF SQLCA.SQLCode <> 0 THEN
        MessageBox("Connect Failed", "Cannot connect to database " + SQLCA.SQLErrText)
        RETURN
END IF

gajender_99Commented:

r u geting the data in datawindow dw_master

post the sql from your datawindows

Hope i can help you

mahalakshmi_sAuthor Commented:
1)yes I get values displayed in dw_master. The sql is :  
 SELECT "owner"."owner_id"  
    FROM "owner"

2)sql for dw_2 is (i have given retrieval arg). When goto to Rows->Retrieve, it asks for Specify Ret Arg n when I give say 3, it pops up the correct owner mesg in the below window DATA
 SELECT "owner"."swis_co",  
         "owner"."swis_town",  
         "owner"."swis_vg",  
         "owner"."owner_id",  
         "owner"."owner_type",  
         "owner"."owner_first_name",  
         "owner"."owner_initial_name",  
         "owner"."owner_last_name",  
         "owner"."owner_name_suffix",  
         "owner"."secondary_name",  
            FROM "owner"  
   WHERE "owner"."owner_id" = :owner_id  
           
gajender_99Commented:
From begin

//in the open event of your window
dw_master.settransobject(SQLCA)
dw_master.retrieve()
dw_master.triggerevent(rowfocuschanged!)

//now go the constructer event of dw_2 and add
settransobject(SQLCA)

//now go to the rowfocuschanged event of dw_master and
long vl_ownerid
if dw_master.getrow()>0 then
    vl_ownerid=dw_master.getitemnumber(dw_master.GetRow(),"owner_id")
    dw_2.retrieve(vl_ownerid)
End if

//this is the simple way

it would be also helpful if you can post the script in the rowfocused event  of dw_master

Gajender






mahalakshmi_sAuthor Commented:
G,
am absolutely new to PB. Am just trying to learn the concepts of DW.
i dont have any code in rowfocused event  of dw_master.

I did whatever u told in ur response, when I run my application, even b4 my window opens I get same error


Database transaction not available, Call SetTrans Object or SetTransObject function


gajender_99Commented:
give me ur email address
and also ur database type

so that i can send u a sample application


Gajender

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mahalakshmi_sAuthor Commented:
mahalakshmi_s@hotmail.com

my database is ASA9
diasroshanCommented:
hi,

"Cannot connect to database DBMS is not supported by your current installation"

ur gettin the above error coz i guess u have created ur DB in a version prior to ASA9....

try creating a new DB with ASA9 and see if the error persists...

there is nothing wrong with the code given by gajender....

even the error..."Database transaction not available, Call SetTrans Object or SetTransObject function" is simply bcoz there is no DB connection...

so check ur db file... its either corrupted or of an older version...

Cheers,
Rosh
mahalakshmi_sAuthor Commented:
Gajender
i made ur sample appl to work...I found u have setthe DB conn in appl open event. I had been trying windows open event.Let me try.
Thanks for effort n ur appln. I apprecaite ur sincerity.
Tq again
Maha
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Editors IDEs

From novice to tech pro — start learning today.