run statement

make

Member
Hi there,

i have build a browser with the UIB, and saved this as browser.w
I want to start this browser from my main programm wich is called
findall.w
I want to start the browser when a button is pressed.
the browser shoukd display all fields of a temp-table wich i define in my main programm.

How can i do that ?

Can anyone help me ?

Greets
make
 

svelkov

New Member
Try with this:

ON CHOOSE OF BUTTON-1 IN FRAME DEFAULT-FRAME
DO:
run c:\progress\wrk\Browse.r.
END.
/* 'c:\progress\wrk\' is optional if you have this in *propath you can write: run Browse.r. else add your *working directory in propath and then start your *program... */
 

dkellgren

Member
If you're unfamiliar with "manually" building a browser, here is a good way to get it started....

Connected to your DB - drop a browser on a window and pick a table - any table - and use the graphical tools to define a "join", a "where", and a "sort". Pick some fields and save your work.

Then go back into the browser properties, uncheck "open query", and hit the "free-form query" button.

This will convert your gui built code into easily accessable trigger code on that browser.

Then, after defining your temp table in definitions, you'll want to look at 2 triggers of the browser you created - "open_query" and "display".

You can modify the "for each" statement in the open_query trigger to read your temp-table the way you want. You can modify the fields of the browser in the "display" trigger.

The nice thing about this method is it let's Progress set up your code the proper way, if you're unfamiliar with how to do so manually.

Finally, you'll need to "open" the query manually - since you turned that option off (above). You may not need to turn it off, depending on how/where your temp-table is loaded... but you can determine that part.

HTH

-dk-
 
You might be better approaching this using a dynamic query and browser. Assume v-hTmp_Buffer is default buffer handle of your temp table.


CREATE QUERY v-hQuery.

v-hQuery:ADD-BUFFER(v-hTmp_Buffer).

v-hQuery:QUERY-PREPARE("PRESELECT EACH tablename").

v-hQuery:QUERY-OPEN.


CREATE BROWSE v-hBrowse
ASSIGN QUERY = v-hQuery
PARENT = FRAME {&FRAME-NAME}:FIRST-CHILD
COLUMN = 1.8
ROW = 1.19
WIDTH-CHARS = 78.4
HEIGHT-CHARS = 10.67
COLUMN-SCROLLING = FALSE
COLUMN-RESIZABLE = TRUE
COLUMN-MOVABLE = TRUE
ROW-MARKERS = FALSE
SEPARATORS = TRUE
MAX-DATA-GUESS = v-hQuery:NUM-RESULTS
VISIBLE = TRUE
SENSITIVE = TRUE
TRIGGERS:
END TRIGGERS.

IF v-hBrowse:SET-REPOSITIONED-ROW(2,"CONDITIONAL") THEN.

DO v-iLoop = 1 TO v-hTmp_Buffer:NUM-FIELDS:
ASSIGN v-hField = v-hTmp_Buffer:BUFFER-FIELD(v-iLoop).
IF v-hField:WIDTH-CHARS GT 320 THEN
v-hBrowse:ADD-CALC-COLUMN(v-hField:DATA-TYPE,"X(320)","",v-hField:COLUMN-LABEL).
ELSE v-hBrowse:ADD-LIKE-COLUMN(v-hField).
END.

IF v-hBrowse:REFRESH() THEN.

APPLY "HOME" TO v-hBrowse.
APPLY "ENTRY" TO v-hBrowse.

 
Top