Start-search on the smartdatabrowser

Hello memoxoz,

Try something like this:

DEFINE VARIABLE hDataObject AS HANDLE NO-UNDO.

/*--------------------------------------------------------*/


FUNCTION getWhere RETURNS CHARACTER
( ) FORWARD.

FUNCTION setQuery RETURNS LOGICAL
( ) FORWARD.


/*---------------------------------------------------------*/

FUNCTION getWhere RETURNS CHARACTER
( ):

DEFINE VARIABLE cWhere AS CHARACTER NO-UNDO.
DEFINE VARIABLE cTemp AS CHARACTER NO-UNDO.

DO WITH FRAME {&FRAME-NAME}:

/*----------------------------*\
BUILD YOUR WHERE-CLAUSE HERE.
EXAMPLE: SEE BELOW,
3 FIELDS ARE SEARCHABLE

PS: WHEN YOU USE 'BEGINS', THE
QUERY CAN BECOME SLOW.
SO WHATCH YOUR INDEXES
\*----------------------------*/

IF fi_field1:SCREEN-VALUE NE "":U THEN
ASSIGN cWhere = cWhere
+ (IF cWhere NE "" THEN " AND " ELSE "")
+ " <table>.<field1> BEGINS '"
+ fi_field1:SCREEN-VALUE
+ "'".

IF fi_field2:SCREEN-VALUE NE "":U THEN
ASSIGN cWhere = cWhere
+ (IF cWhere NE "" THEN " AND " ELSE "")
+ " <table>.<field2> BEGINS '"
+ fi_field2:SCREEN-VALUE
+ "'".

IF fi_field3:SCREEN-VALUE NE "":U THEN
ASSIGN cWhere = cWhere
+ (IF cWhere NE "" THEN " AND " ELSE "")
+ " <table>.<field3> BEGINS '"
+ fi_field3:SCREEN-VALUE
+ "'".

/* etc. */

RETURN cWhere.
END.
END FUNCTION.


/*---------------------------------------------------------*/

FUNCTION setQuery RETURNS LOGICAL
( ):

IF VALID-HANDLE(hDataObject) = FALSE THEN
ASSIGN hDataObject = WIDGET-HANDLE(DYNAMIC-FUNCTION("Linkhandles","filter-target")).

IF VALID-HANDLE(hDataObject) THEN
DO:
DYNAMIC-FUNCTION("getRepositionQuery" IN hDataObject).

DYNAMIC-FUNCTION("CloseQuery" IN hDataObject).

DYNAMIC-FUNCTION("PrepareQuery" In hDataObject, "").

DYNAMIC-FUNCTION("setQueryWhere" IN hDataObject, getWhere()).

DYNAMIC-FUNCTION("OpenQuery" IN hDataObject).

RETURN NO-APPLY.
END.

RETURN FALSE.
END FUNCTION.


Good luck with it.

 
Dude,
I think the reply given missed the objective of the question.
I believe you wanted to have a M$ like browse. Where you click on the column title which would then open the query and start the search putting that column in order.
If I am right in my interpretation of the problem, you need to make the browse selectable i.e allow focus to enable the column selection. There is a trick to allow this, though I am NOT at my desk with my notes, I will check it out.
 
Back
Top