Forum Post: RE: dynamic query

  • Thread starter Thread starter Marko Myllymäki
  • Start date Start date
Status
Not open for further replies.
M

Marko Myllymäki

Guest
By the way, in our application we have one minor static query related problem which we have not been able to solve. We have lots of .w programs, where the browse queries are defined statically in the OPEN_QUERY trigger of the browse. Luckily, AppBuilder generates useful preprocessor directives for us including these (suppose we have a browse and query both named BROWSE-1): {&OPEN-QUERY-BROWSE-1} and {&QUERY-STRING-BROWSE-1} . Using the latter, we can now open the (static) query dynamically (in a general include file) by using: QUERY-PREPARE('{&QUERY-STRING-{&BROWSE-NAME}}'). However, if the query string includes a single quotation mark, we get a runtime error (Unmatches quotes). Double quotes in the query string are fine. If we use double quotes around the preprocessor directive in QUERY-PREPARE then we can use single quotes in the query string but not double quotes. We have not found a reliable way how to accept both. We have advised programmers to avoid using single quotes in query strings. Our workaround for this problem is that we catch the possible error when opening the query dynamically and in case of an error, we open the query statically using {&OPEN-QUERY-{&BROWSE-NAME}}. With this technique, we can open most of the static queries dynamically. So, only those queries which include a single quotation mark, are opened statically.

Continue reading...
 
Status
Not open for further replies.
Back
Top