[Progress Communities] [Progress OpenEdge ABL] Forum Post: RE: Newbie questions about dynamic query preparation in ABL

  • Thread starter Thread starter Peter Judge
  • Start date Start date
Status
Not open for further replies.
P

Peter Judge

Guest
What I'm wondering is how to use an argument/variable, and change it in a loop, and ensure that the query will respect it's value. Ie. if I have iCustNum and I have a query that I prepared ("FOR EACH customer WHERE CustNum = iCustNum") then the query should be prepared/compiled once, and executed repeatedly for different customers by changing the value of iCustNum. Short answer is you can't. There are dynamic find statements - like FIND-FIRST(predicate-expression, lock-mode, wait-mode) - that may feel more natural but the nature of dynamic queries is such that they require an explicit predicate/WHERE. You can optimise your code so that you don't need to create/destroy the entire query on each iteration of the containing loop, but you will need to create an explicit WHERE on each iteration. > It seems unnatural to repeatedly compile a piece of code that isn't really changing. If it isn't changing then you may not need a dynamic query.

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