Question Scoped-define Query

jmac13

Member
Hi All, (I'm using open edge 10.2b)

I've got a static browse created in appbuilder which creates lots of scope-defined query info. my question is if I have the handle to the browse how do I get to the Query-string? I know the browse has a query object I can get to but the PREPARE-STRING is "?". how do I get to that info? I know I can open the query by doing {&OPEN-QUERY-BRDetail} but I'd like to get to it via a handle so that I can pass a program a handle and it doesn't care if its static or dynamic and I can open the query.

Thanks

Code:
&Scoped-define FIELDS-IN-QUERY-BRDetail ttRecs.intLineNo ttRecs.chrString 
&Scoped-define ENABLED-FIELDS-IN-QUERY-BRDetail 
&Scoped-define SELF-NAME BRDetail
&Scoped-define QUERY-STRING-BRDetail PRESELECT EACH ttRecs use-index main NO-LOCK
&Scoped-define OPEN-QUERY-BRDetail OPEN QUERY {&SELF-NAME} PRESELECT EACH ttRecs use-index main NO-LOCK.
&Scoped-define TABLES-IN-QUERY-BRDetail ttRecs
&Scoped-define FIRST-TABLE-IN-QUERY-BRDetail ttRecs
 

Cringer

ProgressTalk.com Moderator
Staff member
Can't you just do lv-BrowseHandle:QUERY:QUERY-OPEN or something like that?
 

jmac13

Member
Get the below.. I'm guessing I'm going have to get the static info and put in query..just seems a bit rubbish to me

Code:
QUERY-OPEN for query <name> requires a previous QUERY-PREPARE. (7312)
 
The query object method QUERY-OPEN cannot be run until the QUERY-PREPARE method has been run.
 

Cringer

ProgressTalk.com Moderator
Staff member
I do as little as possible with AppBuilder browses these days. I've written a library so that I can just whack an empty browse on the screen and throw its handle along with a tt handle containing the data at the library and it populates the browse dynamically. The big advantages are you don't have to muck around with the AppBuilder, and all browses have the same look and feel/functionality.
 

Osborne

Active Member
According to the manual, the information is not available if a standard open query statement is used:
If QUERY-PREPARE was not called, or the query was just opened with the OPEN QUERY statement, PREPARE-STRING has the Unknown value (?).
Instead of opening the query using {&OPEN-QUERY-BRDetail}, open it this way and there should be a value for PREPARE-STRING:
Code:
QUERY BRDetail:QUERY-PREPARE("{&QUERY-STRING-BRDetail}").
QUERY BRDetail:QUERY-OPEN().
MESSAGE QUERY BRDetail:PREPARE-STRING VIEW-AS ALERT-BOX INFORMATION.
 

jmac13

Member
Hi Osborne,

Thanks I got to that conclusion myself... After considering it I think I'm going to change my code to be a dynamic browse.. So I might have to come back to you Cringer :)
 

Osborne

Active Member
I just realised I missed that you wanted to get the information via the browse handle. In that case, something like this should work:
Code:
BRDetail:QUERY:QUERY-PREPARE("{&QUERY-STRING-BRDetail}").
hBrowse = BRDetail:HANDLE.
MESSAGE hBrowse:QUERY:PREPARE-STRING VIEW-AS ALERT-BOX INFORMATION.
 

jmac13

Member
Cringer when you've got a dynamic browse and you are sending it a temp-table handle how do you deiced what columns to show? as in sometimes you don't want to show all the columns in a temp-table. Do you do a ADD-COLUMNS-FROM on the browse then have a exception list and hide the ones you don't want? Thanks
 

jmac13

Member
Another question.. when I define my columns in a static browse it seems fit the columns better...

So I've got this simple Temp-table and I put intLineNo and chrString in the display statment the intLineNo fits nicely but if I use ADD-COLUMNS-FROM the intLineNo column is massive. Anyway to get it to do the same I don't want to have to sit there a put all my column widths in

Thanks

Code:
define temp-table ttRecs no-undo           
    field intLineNo as integer   
    field chrString as character format "x(30)"         
    field rowRecord as rowid   
    index main intLineNo.
 

Cringer

ProgressTalk.com Moderator
Staff member
Don't tell anyone...
I get around the "No Display" issue by the use of options on the HELP of each tt field.
That code's not completely tested and also WIP, but gives you a good starting point.
 

Attachments

  • brwsmgrpm.p
    9.3 KB · Views: 18
Top