[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now


datawindowchild arguments dependant on retrieval result in same datawindow

Posted on 2004-08-20
Medium Priority
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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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 it...it'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 u...in 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand column That will then direct you to their download page. From that p…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

650 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