Solved

How do I hide or protect specific rows that have been returned from a drop down data window?

Posted on 2007-11-30
7
718 Views
Last Modified: 2013-12-26
I have a drop down data window that returns multiple rows.  I need to hide or protect some of the rows that have been returned.   I know that if I wanted to protect a column that is easily done in the properties of the column, but in my case here I only want to weed out specific rows.  Can I do this on a filter in some way?  I need to display these rows on initial retrieve, but then I do not want the user to be able to select them going forward.  
What I want to do is hide or protect any rows where my effective date is not the max effective date on the table for a specific customer.

Any help would be greatly appreciated.

Thanks!
Here is my select statement on the drop down data window:
 
select  Distinct dbo.tcu_cust.cust_name ,
          dbo.tcu_cust.business_unit,
		dbo.tcu_cust.ps_cust_id,
		dbo.tcu_cust_address.address1 ,
 		dbo.tcu_cust_address.address2 ,
  		dbo.tcu_cust_address.city ,
  		dbo.tcu_cust_address.state ,
    	dbo.tcu_cust_address.postal,
    	dbo.tcu_cust_address.address_id,
        dbo.tcu_cust_address.effective_date
FROM    dbo.tcu_cust  with (index ( i_cust_01)), dbo.tcu_cust_addr_seq, dbo.tcu_cust_address
WHERE ( dbo.tcu_cust.cust_id = dbo.tcu_cust_addr_seq.cust_id )
and   ( dbo.tcu_cust_addr_seq.cust_id = dbo.tcu_cust_address.cust_id )
and   ( dbo.tcu_cust_addr_seq.address_seq_nbr = dbo.tcu_cust_address.address_seq_nbr )
and   ( dbo.tcu_cust_addr_seq.ship_to_addr = 'Y' )
and   ( dbo.tcu_cust.cust_type = 'PSOFT' )
and   ( dbo.tcu_cust.cust_status >= 'A' and dbo.tcu_cust.cust_status <= 'I' )
and   ( ( dbo.tcu_cust.ps_corp_cust_id
		in (select dbo.tcu_cust.ps_cust_id
			from dbo.tcu_cust
			where  dbo.tcu_cust.cust_id = :ai_cust_id))
		or ( dbo.tcu_cust.cust_id = :ai_cust_id )
		or	( dbo.tcu_cust.ps_cust_id
		in (select dbo.tcu_cust_add_relations.ps_site_id
			from dbo.tcu_cust_add_relations
			where  dbo.tcu_cust_add_relations.cust_id = :ai_cust_id)))
and   ( dbo.tcu_cust.ship_to_flg = 'Y' )

Open in new window

0
Comment
Question by:BlackBoxVS
  • 4
  • 2
7 Comments
 
LVL 14

Expert Comment

by:sandeep_patel
ID: 20385960
Ofcourse you can do with filter or by changing where clause....but still i am not clear about....
<I need to display these rows on initial retrieve, but then I do not want the user to be able to select them going forward.>

please clearify when exactly you want to filter out?
Regards,
Sandeep
0
 

Author Comment

by:BlackBoxVS
ID: 20395492
On my initial select from the drop down, I want to display all rows (both active and inactive customers), but when the user goes to click on a row from the list, I want them to only be able to choose from the active customers - so I want the inactive customers to be listed but not enabled.  Does this help?

Thanks!
0
 
LVL 14

Accepted Solution

by:
sandeep_patel earned 125 total points
ID: 20396340
Ok..it's more clear now..
As you want to display and don't allow to select there is only option to write a script in itemchanged event of the datawindow.  Get the value from the column which says about active status and if it is not active RETURN 1 from the itemchanged event. Example script is given in Code Snippet.

Also I would suggest to display those rows in different color in DDDW by setting background/ foreground color property, so it would be easier for user to know it before selection.

And if you don't want to display the records itself then filter is the option.

Regards,
Sandeep
// assumed that customer_id is the column to which dddw is attached and cust
// cust_id is the datavalue for dddw
// isactive is the column which says about the active status of the customer. If it's date you can take it as effective_date
 
datawindowchild child1
string ls_custid
long ll_row
 
// Get dddw reference
dw_1.Getchild('customer_id',child1)
// Get datavalue from dddw
ls_custid = data
// search record for selected datavalue from dddw
ll_row = child1.Find('ps_cust_id = ' + ls_custid,1,child1.RowCount())
// If record found
If ll_row > 0 Then
   // Get value of column for decision making
   ls_isactive = child1.object.isactive[ll_row]
   // OR ld_eff_date = child1.object.effective_date[ll_row]
   // check value for decision
   If ls_isacgive = 'N' Then
   // If ld_eff_date <> max_date Then
      Messagebox('Invalid','Current selection for customer is not active')
      RETURN 1
   End if
End If

Open in new window

0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 3

Expert Comment

by:ced888
ID: 20400241
Just to add, if you want to hide them from the list instead of just enabling or disabling them what you can do is to put a script in the rowchanged event of the datawindow.

In the rowchanged you getthe datawindow child then you filter them accordingly. this way the "list" will change based on the row that is selected.

Hope this helps.


0
 

Author Comment

by:BlackBoxVS
ID: 20412947
A new question - I am trying to use SetDetailHeight and set the height to 0 on the rows I want to hide.  When I step through debug, this works, but the change to the datawindow child does not seem to save - original height is still displayed.   Does the datawindow need specific settings for this to work?
0
 

Author Comment

by:BlackBoxVS
ID: 20413143
I figured out my problem.  I have it working now.  Thanks for the suggestions.
0
 

Author Closing Comment

by:BlackBoxVS
ID: 31412024
Thanks for the help.  I now have my datawindow child working using the setdetailheight option.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Unable to install breakpoint in Eclipse: Absent Line Number Information 2 761
missing "main" in Java on Eclipse 4 74
I could not build boost code, 10 96
Syntax Error 2 77
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…
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: …
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

830 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