progress 4gl - dynamic query for openedge -




good day:

quick question, can perform dynamic query in openedge?

example:

def temp-table tt-num1 field f1 int field f2 int.  def temp-table tt-num2 field f1 int field f2 int.  def temp-table tt-num3 field f1 int field f2 int. 

what need this:

procedure repeat-query: each 'variable contains table-name' no-lock.  disp f1 f2.  end. end procedure. 

or other ways can solve problem

how proceed this? tried check dynamic query found in internet no luck. in advance.

if go directly https://documentation.progress.com/#page/progdocindex%2fopenedge.html can find documentation around openedge. instance dynamic queries.

i don't understand try here's example of dynamic query.

define temp-table tt-num1 no-undo     field f1 integer     field f2 integer.  define temp-table tt-num2 no-undo     field f1 integer     field f2 integer.  define temp-table tt-num3 no-undo     field f1 integer     field f2 integer.   create tt-num1. assign      tt-num1.f1 = 1     tt-num1.f2 = 1.  create tt-num1. assign      tt-num1.f1 = 1     tt-num1.f2 = 2.  create tt-num1. assign      tt-num1.f1 = 2     tt-num1.f2 = 1.  create tt-num1. assign      tt-num1.f1 = 2     tt-num1.f2 = 2.  define variable hquery  handle      no-undo. define variable cbuffer character   no-undo. define variable cfield  character   no-undo. define variable ivalue  integer     no-undo.  assign      cbuffer = "tt-num1"     cfield  = "f1"     ivalue  = 1.  create query hquery.  hquery:add-buffer(cbuffer). hquery:query-prepare("for each " + cbuffer + " " + cbuffer + "." + cfield + " = " + string(ivalue)). hquery:query-open().  queryloop: repeat:     hquery:get-next().      if hquery:query-off-end leave queryloop.      display hquery:get-buffer-handle(1):buffer-field(cfield):buffer-value. end. hquery:query-close().  delete object hquery. 

as stefan drissen mentions in valid comment: loop can more compact:

do while hquery:get-next():     /* code goes here */ end. 




wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -