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

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.

Here is my select statement on the drop down data window:
select  Distinct dbo.tcu_cust.cust_name ,
		dbo.tcu_cust_address.address1 ,
 		dbo.tcu_cust_address.address2 , ,
  		dbo.tcu_cust_address.state ,
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

Who is Participating?
sandeep_patelConnect With a Mentor Commented:'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.

// 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
// 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

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?
BlackBoxVSAuthor Commented:
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?

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

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.

BlackBoxVSAuthor Commented:
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?
BlackBoxVSAuthor Commented:
I figured out my problem.  I have it working now.  Thanks for the suggestions.
BlackBoxVSAuthor Commented:
Thanks for the help.  I now have my datawindow child working using the setdetailheight option.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.