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
716 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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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. …
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
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…

746 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now