waynesingh
Member
Hi All,
I have just started (today) to try and use a Dynamic Query/Browse setup. Is a very simple browse where you pass in the buffer for the table (bh = BUFFER tablename:HANDLE), the Query and then the fields you want to display in a comma seperated list. My problem is that I have no idea on how to pass back information form what the user has selected. Maybe I am missing something but finding it hard to find this information. Please find some example code below...
Calling Program:
DEF VAR bh AS WIDGET-HANDLE NO-UNDO.
bh = BUFFER Table:HANDLE.
RUN ofs\dynbrws.w (INPUT bh,
INPUT "for each Table NO-LOCK",
INPUT "Table.Field,Table.Field2").
Definitions:
/* Parameters Definitions --- */
DEF INPUT PARAM bh AS WIDGET-HANDLE NO-UNDO.
DEF INPUT PARAM ipQuery AS CHAR NO-UNDO.
DEF INPUT PARAM ipFields AS CHAR NO-UNDO.
/* Local Variable Definitions --- */
DEF VAR qh AS WIDGET-HANDLE NO-UNDO.
DEF VAR Browse-Hndl AS WIDGET-HANDLE NO-UNDO.
DEF VAR lvInt AS INT NO-UNDO.
/* Create Query */
CREATE QUERY qh.
qh:SET-BUFFERS(bh).
DEFINE FRAME Frame-2
WITH SIZE 132 BY 18 THREE-D NO-LABELS.
CREATE BROWSE Browse-Hndl
ASSIGN
FRAME = FRAME Frame-2:HANDLE
QUERY = qh
TITLE = " "
X = 2
Y = 2
WIDTH = 130
DOWN = 12
VISIBLE = TRUE
SENSITIVE = TRUE
READ-ONLY = NO
COLUMN-SCROLLING = TRUE
SEPARATORS = YES.
Main-Block:
MAIN-BLOCK:
DO ON ERROR UNDO MAIN-BLOCK, LEAVE MAIN-BLOCK
ON END-KEY UNDO MAIN-BLOCK, LEAVE MAIN-BLOCK:
RUN enable_UI.
qh:QUERY-PREPARE(ipQuery).
qh:QUERY-OPEN.
IF NUM-ENTRIES(ipFields) > 1 THEN
DO lvInt = 1 TO NUM-ENTRIES(ipFields):
Browse-Hndl:ADD-LIKE-COLUMN(ENTRY(lvInt,ipFields)).
END.
ENABLE ALL WITH FRAME Frame-2.
IF NOT THIS-PROCEDUREERSISTENT THEN
WAIT-FOR CLOSE OF THIS-PROCEDURE.
END.
I have an OK button on the screen and wanted some way to pass back an output that will be enough for the calling program to know what was selected.
I hope you understand what I am trying to acheive as I know I have not explained very well, but I only got back from holidays today and am still getting my brain fully into gear
Thanx in advance for any help offered.
Cya.
I have just started (today) to try and use a Dynamic Query/Browse setup. Is a very simple browse where you pass in the buffer for the table (bh = BUFFER tablename:HANDLE), the Query and then the fields you want to display in a comma seperated list. My problem is that I have no idea on how to pass back information form what the user has selected. Maybe I am missing something but finding it hard to find this information. Please find some example code below...
Calling Program:
DEF VAR bh AS WIDGET-HANDLE NO-UNDO.
bh = BUFFER Table:HANDLE.
RUN ofs\dynbrws.w (INPUT bh,
INPUT "for each Table NO-LOCK",
INPUT "Table.Field,Table.Field2").
Definitions:
/* Parameters Definitions --- */
DEF INPUT PARAM bh AS WIDGET-HANDLE NO-UNDO.
DEF INPUT PARAM ipQuery AS CHAR NO-UNDO.
DEF INPUT PARAM ipFields AS CHAR NO-UNDO.
/* Local Variable Definitions --- */
DEF VAR qh AS WIDGET-HANDLE NO-UNDO.
DEF VAR Browse-Hndl AS WIDGET-HANDLE NO-UNDO.
DEF VAR lvInt AS INT NO-UNDO.
/* Create Query */
CREATE QUERY qh.
qh:SET-BUFFERS(bh).
DEFINE FRAME Frame-2
WITH SIZE 132 BY 18 THREE-D NO-LABELS.
CREATE BROWSE Browse-Hndl
ASSIGN
FRAME = FRAME Frame-2:HANDLE
QUERY = qh
TITLE = " "
X = 2
Y = 2
WIDTH = 130
DOWN = 12
VISIBLE = TRUE
SENSITIVE = TRUE
READ-ONLY = NO
COLUMN-SCROLLING = TRUE
SEPARATORS = YES.
Main-Block:
MAIN-BLOCK:
DO ON ERROR UNDO MAIN-BLOCK, LEAVE MAIN-BLOCK
ON END-KEY UNDO MAIN-BLOCK, LEAVE MAIN-BLOCK:
RUN enable_UI.
qh:QUERY-PREPARE(ipQuery).
qh:QUERY-OPEN.
IF NUM-ENTRIES(ipFields) > 1 THEN
DO lvInt = 1 TO NUM-ENTRIES(ipFields):
Browse-Hndl:ADD-LIKE-COLUMN(ENTRY(lvInt,ipFields)).
END.
ENABLE ALL WITH FRAME Frame-2.
IF NOT THIS-PROCEDUREERSISTENT THEN
WAIT-FOR CLOSE OF THIS-PROCEDURE.
END.
I have an OK button on the screen and wanted some way to pass back an output that will be enough for the calling program to know what was selected.
I hope you understand what I am trying to acheive as I know I have not explained very well, but I only got back from holidays today and am still getting my brain fully into gear
Thanx in advance for any help offered.
Cya.