datawindowchild arguments dependant on retrieval result in same datawindow

Posted on 2004-08-20
Last Modified: 2013-12-26
Sorry if the title is confusing, but so is the topic.

I have a one to many relationship between two datawindows so that when you click on a row in dw_1 it shows multiple rows in dw_2.  I have a dwc field in dw_2 that has two arguments, one of which is dependant on the information that comes back when dw_2 is retrieved.  So I can't figure out how dynamically retrieve the data window for each row.

Essentially I am trying to show the number of notes that have been created for a particular provider as follows:

company c
                provider_1   provider_name  dwc_number_of_notes_for_provider (e.g. 6)
                provider_2   provider_name  dwc_number_of_notes_for_provider (e.g. 0)
                provider_3   provider_name  dwc_number_of_notes_for_provider (e.g. 4)

Here is the code, but I cannot figure out where to put it to make it work:

//            DWC to get number of notes for provider

            int rownbr3
            rownbr3 = tab_1.tabpage_1.dw_2.getrow()

            int sp_id3
            sp_id3 = getitemnumber(rownbr3, "service_provider_sp_id")

//            DataWindowChild dwc_provider_notes
            integer rtncode3
//            rtncode3 = tab_1.tabpage_1.dw_2.GetChild('sp_company_notes', dwc_provider_notes)
            rtncode3 = tab_1.tabpage_1.dw_2.GetChild('compute_1', dwc_provider_notes)

            messagebox("Return code is ", string(rtncode3))
            //***MAY NEED MORE HERE
            long iii_row3
            iii_row3 = dwc_provider_notes.insertrow(0)
            int dwcrows3
            dwcrows3 = dwc_provider_notes.Retrieve(gv_effort_id,sp_id3)
            messagebox("Return rows are ", string(dwcrows3))
//            tab_1.tabpage_1.dw_2.settransobject(sqlca);

Perhaps there is an alternate way to do it.  Essentially, I just want a field to display a rowcount for table b that is based on information that in the same row.

Thank you,

Question by:pemurray
  • 2

Expert Comment

ID: 11856591
>>> So I can't figure out how dynamically retrieve the data window for each row
 if this means u want to retrieve the dddw for each row retrieved in dw_2, then it's not the correct way... because u retireve a dddw in the dw, and it applies to all rows.

what you can do is to retrieve the dddw after data is retrieved in the dw_2, and have another dddw( visible only for current row) that shows filterd record from the first dddw, depending on the row in dw_2.

LVL 14

Accepted Solution

sandeep_patel earned 500 total points
ID: 11857824
....Essentially, I just want a field to display a rowcount for table b that is based on information that in the same row....

for this reason no need to take dropdowndatawindow. Following are the two ways to solve the problem.

1) create user defined function udf_getrowcount() which returns long and argument is what u r passing in dropdowndatawindow ( say arg1 and arg2 )

now in function write down

//-- function start
Long ll_rowcount
select count(*) into :ll_rowcount from table_name where col1 = :arg1 and col2 = :arg2 ;
return ll_rowcount
//-- function end

now put computed expression in dw_2 and writedown
udf_getrowcount(arg1,arg2) as a expression in it.

run the application and check's done..

2) create a datawindow on required table with the syntax as described in solution 1, but without 'into :ll_rowcount'...define retrieval argument arg1 and arg2...assign in where clause...put this datawindow as a nested datawindow in dw_2...pass the argument to nested datawindow....that's it...

use any of the solution whatever is convininent to case of any problem do reply...

have a nice day...


Author Comment

ID: 11859878

Thank you,

This is my first time creating a user function so please bear with me...

I created the user function and named it: udf_getrowcount

Here is the code:

//-- function start
Long ll_rowcount
select count(*) into :ll_rowcount from service_provider_notes where effort_id = :gv_effort_id and sp_id = :sp_id ;
return ll_rowcount
//-- function end

The function painter whined a bit as the argument names are the same as two global variables, but it let me save it.

I created a computed field and typed this into the expression: udf_getrowcount(gv_effort_id , sp_id)

But I could not save the field because I keep getting the following error in the expression painter: ')' expected to close expression after function.

I spent quite a bit of time researching this but could not come up with an answer.

Thank you again for your help!!


Author Comment

ID: 11861593
Okay, I figured it out by using the colum names for the rows instead of the global variables as the arguments.  Doesn't make sense to me but I did get it done.  I notice that it is not as real time as I would like (e.g., you have to reretrieve after you do not to make it update the dw.  But I am happy with the solution.  Sandeep will get the point, thank you.

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
"Primary Reference" Warning in Visual Studio 5 44
Visual Studio Debugging 3 151
Use tracing facilities in your browser steps 2 126
Angular JS Route 3 98
In our object-oriented world the class is a minimal unit, a brick for constructing our applications. It is an abstraction and we know well how to use it. In well-designed software we are not usually interested in knowing how objects look in memory. …
Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…

713 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question