Hi all,
Secondary browse showing no results on first click
I'm writing a simple little tool that queries our Progress 9.1c db for certain information.
It takes a user input (in frame 1), runs a query and shows results in a read-only browse (in frame 2).
Then, if the user clicks on a line in this primary 'browse', it runs a secondary query based on data in the first, and displays the results in a secondary browse (frame 3).
My problem is that the secondary browse shows no results the first time the user clicks on a line in the primary. However, it shows the expected results the second time that line is clicked upon.
It doesn't seem to matter which trigger event I use, this behaviour does not change. The only way I can fool the user into thinking it works properly is by running the same query twice in the trigger block, separated only by an ENABLE ALL for the appropriate frame. This seems like poor programming however, so I must be doing something wrong.
Would someone be kind enough to take a quick look at the following snippet of code and see if there is an glaring error on my part? Many thanks to anyone who reads this post :biggrin:
<code snippet>
/* Query1/Brwse1/Brwse1-Frame ****************************/
DEFINE QUERY Query1 FOR Table1 FIELDS (Fields),
Table2 FIELDS (Fields)
SCROLLING.
DEFINE BROWSE Brwse1
QUERY Query1 NO-LOCK NO-WAIT
DISPLAY Table1.Field FORMAT "x(9)" LABEL "ColumnLabel"
Table2.Field FORMAT "x(9)" LABEL "ColumnLabel"
WITH SIZE 128 BY 6
EXPANDABLE
LABEL-FONT 17
SEPARATORS.
ASSIGN BROWSE Brwse1OPUP-MENU = MENU Brwse1-Menu:Handle.
DEFINE FRAME Brwse1-Frame
Brwse1
WITH SIDE-LABELS
AT ROW 8 COL 1
SIZE 128 BY 6
FONT 4
NO-BOX.
/* Query2/Brwse2/Brwse2-Frame ****************************/
/* Define buffers for the 2 tables re-used in Query2, to avoid conflicts with Query1 */
DEFINE BUFFER Table1a FOR Table1.
DEFINE BUFFER Table2a FOR Table2.
DEFINE QUERY Query2 FOR Table1a FIELDS (Fields),
Table2a FIELDS (Fields)
SCROLLING.
DEFINE BROWSE Brwse2
QUERY Query2 NO-LOCK NO-WAIT
DISPLAY Table1.Field FORMAT "x(9)" LABEL "ColumnLabel"
Table2.Field FORMAT "x(9)" LABEL "ColumnLabel"
WITH SIZE 128 BY 6
EXPANDABLE
MULTIPLE
LABEL-FONT 17
SEPARATORS.
ASSIGN BROWSE Brwse2OPUP-MENU = MENU Brwse2-Menu:Handle.
DEFINE FRAME Brwse2-Frame
Brwse2
WITH SIDE-LABELS
AT ROW 16 COL 1
SIZE 128 BY 6
FONT 4
NO-BOX.
...
/* Control Triggers *************************************************************************/
...
ON RETURN OF txtSrchVal <user input text box>
DO:
DEFINE VARIABLE lReturnValue AS LOGICAL.
txtSrchVal = txtSrchVal:SCREEN-VALUE.
OPEN QUERY Query1 FOR
EACH Table1
WHERE Table1.Field1 = "Ripley"
AND Table1.Field2 = INTEGER(txtSrchVal) NO-LOCK,
EACH Table2 LEFT OUTER-JOIN OF Table1
WHERE Table2.Field1 = Table1.Field1 NO-LOCK
BY Table1.Field1
BY Table1.Field2.
ENABLE ALL WITH FRAME Brwse1-Frame.
ENABLE ALL WITH FRAME DEFAULT-FRAME.
CURRENT-WINDOW:TITLE = "Sales Order Mini-tracker" + " - " + txtSrchVal.
APPLY "TAB":U TO btnSrchVal.
lReturnValue = winRB:LOAD-MOUSE-POINTER("ARROW").
END.
...
ON LEFT-MOUSE-CLICK OF BROWSE Brwse1
DO:
EACH Table1a
WHERE Table1a.Field1 = Table1.Field2 NO-LOCK,
EACH Table2a LEFT OUTER-JOIN OF Table1a
WHERE Table2a.Field1 = Table1a.Field1 NO-LOCK
BY Table1a.Field1
BY Table1a.Field2.
ENABLE ALL WITH FRAME Brwse2-Frame.
END.
Thanks again, and have a very happy Christmas holiday
Andz.
Secondary browse showing no results on first click
I'm writing a simple little tool that queries our Progress 9.1c db for certain information.
It takes a user input (in frame 1), runs a query and shows results in a read-only browse (in frame 2).
Then, if the user clicks on a line in this primary 'browse', it runs a secondary query based on data in the first, and displays the results in a secondary browse (frame 3).
My problem is that the secondary browse shows no results the first time the user clicks on a line in the primary. However, it shows the expected results the second time that line is clicked upon.
It doesn't seem to matter which trigger event I use, this behaviour does not change. The only way I can fool the user into thinking it works properly is by running the same query twice in the trigger block, separated only by an ENABLE ALL for the appropriate frame. This seems like poor programming however, so I must be doing something wrong.
Would someone be kind enough to take a quick look at the following snippet of code and see if there is an glaring error on my part? Many thanks to anyone who reads this post :biggrin:
<code snippet>
/* Query1/Brwse1/Brwse1-Frame ****************************/
DEFINE QUERY Query1 FOR Table1 FIELDS (Fields),
Table2 FIELDS (Fields)
SCROLLING.
DEFINE BROWSE Brwse1
QUERY Query1 NO-LOCK NO-WAIT
DISPLAY Table1.Field FORMAT "x(9)" LABEL "ColumnLabel"
Table2.Field FORMAT "x(9)" LABEL "ColumnLabel"
WITH SIZE 128 BY 6
EXPANDABLE
LABEL-FONT 17
SEPARATORS.
ASSIGN BROWSE Brwse1OPUP-MENU = MENU Brwse1-Menu:Handle.
DEFINE FRAME Brwse1-Frame
Brwse1
WITH SIDE-LABELS
AT ROW 8 COL 1
SIZE 128 BY 6
FONT 4
NO-BOX.
/* Query2/Brwse2/Brwse2-Frame ****************************/
/* Define buffers for the 2 tables re-used in Query2, to avoid conflicts with Query1 */
DEFINE BUFFER Table1a FOR Table1.
DEFINE BUFFER Table2a FOR Table2.
DEFINE QUERY Query2 FOR Table1a FIELDS (Fields),
Table2a FIELDS (Fields)
SCROLLING.
DEFINE BROWSE Brwse2
QUERY Query2 NO-LOCK NO-WAIT
DISPLAY Table1.Field FORMAT "x(9)" LABEL "ColumnLabel"
Table2.Field FORMAT "x(9)" LABEL "ColumnLabel"
WITH SIZE 128 BY 6
EXPANDABLE
MULTIPLE
LABEL-FONT 17
SEPARATORS.
ASSIGN BROWSE Brwse2OPUP-MENU = MENU Brwse2-Menu:Handle.
DEFINE FRAME Brwse2-Frame
Brwse2
WITH SIDE-LABELS
AT ROW 16 COL 1
SIZE 128 BY 6
FONT 4
NO-BOX.
...
/* Control Triggers *************************************************************************/
...
ON RETURN OF txtSrchVal <user input text box>
DO:
DEFINE VARIABLE lReturnValue AS LOGICAL.
txtSrchVal = txtSrchVal:SCREEN-VALUE.
OPEN QUERY Query1 FOR
EACH Table1
WHERE Table1.Field1 = "Ripley"
AND Table1.Field2 = INTEGER(txtSrchVal) NO-LOCK,
EACH Table2 LEFT OUTER-JOIN OF Table1
WHERE Table2.Field1 = Table1.Field1 NO-LOCK
BY Table1.Field1
BY Table1.Field2.
ENABLE ALL WITH FRAME Brwse1-Frame.
ENABLE ALL WITH FRAME DEFAULT-FRAME.
CURRENT-WINDOW:TITLE = "Sales Order Mini-tracker" + " - " + txtSrchVal.
APPLY "TAB":U TO btnSrchVal.
lReturnValue = winRB:LOAD-MOUSE-POINTER("ARROW").
END.
...
ON LEFT-MOUSE-CLICK OF BROWSE Brwse1
DO:
EACH Table1a
WHERE Table1a.Field1 = Table1.Field2 NO-LOCK,
EACH Table2a LEFT OUTER-JOIN OF Table1a
WHERE Table2a.Field1 = Table1a.Field1 NO-LOCK
BY Table1a.Field1
BY Table1a.Field2.
ENABLE ALL WITH FRAME Brwse2-Frame.
END.
Thanks again, and have a very happy Christmas holiday
Andz.