Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HELP! How to sort registries in a DW according a ddlb selection?

Status
Not open for further replies.

montjoile

Programmer
May 23, 2011
23
CO
I have a datawindow freeform, and I need to let the user to search according a drop down listbox, if the user select one field of the ddlb, then a sle is displayed allowing the user to enter a value to make the searching more specific, then I have to display all the registries that matches

how can I do this?
thanks
 
if I understand well:

1)does your ddlb contain values that correspond to certain fields of a table?

2)the search should limit the selected value of the ddlb with the value entered in the sle?

If so .... then
you can do various stuff:
------------------------
easiest:
-use the setfilter() and filter() functions after having retrieved the data in the datawindow (dw_1.retrieve() )

another:
-or: change/compose the where clause of the datawindow dynamically. You can use the Modify() function of datawindows or you could also put some code in the sqlpreview event, to modify/add your conditions to the select statement that enteres there as an argument, just before being send to the database to obtain the values.

-you can define a retrieval argument for each posible value in the ddlb to the datawindow:
if for example the ddlb has 3 fields: field1, field2, field3
and the user chooses for example field2 in the ddlb your retrieve statement could look like this.

dw_1.retrieve(-1, long(sle_1.text), -1)

the sqlstatement (datasource) of your datawindow could have something like:

select * from mytable
where ( field1 = :arg1 or :arg1 = -1) and
(field2 = :arg2 or :arg2 = -1) and
(field3 = :arg3 or :arg3 = -1)

what you'd achieve by this is that field1, ..2, and ..3 are only limiting when the argument value passed to the retrieve() is diferent then -1.

if the fieldtypes are diferent for example string.. I use to pass '[todos]' instead of a -1 value.

I don't know if you get the idea.




regards,
Miguel L.
 
(I described three methods in previous post just to avoid confusion).

1) "easiest",

2) "another"

3) "-you can define a retrieval argument for each posible value in the ddlb to the datawindow:"

(to avoid you might think the third makes part of the second)



regards,
Miguel L.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top