title: Can I specify the contents of the buffer while creating it in Progress-4GL?
body: <p>Noob to Progress here and self-taught while working so sorry if I missed some obvious things. I learned about buffers yesterday and I'd like to know if it's possible to delimit the scope of what the buffer will search. Below, an example of what I want to know.</p>
  <pre><code>DEFINE BUFFER ex1 FOR emit WHERE emit.id &gt; 50000.
  
  FOR EACH ex1:
      DISP ex1.id ex1.name.
  end.
  </code></pre>
  <p>I know I could put the WHERE on the FOR EACH part in this example, but I'd like to know if and how can I delimit the buffer so I can do what I intend to in my code here.</p>
  <p>Thanks for the help.</p>
  <p>EDIT: I'll put the code I wrote here so it's easier to understand what I meant. I really don't see any other solutions besides using temp-tables and it makes everything so much slower. I'll keep my code like this but if anyone knows of a better solution, just give me a shout. Thanks again for your time.</p>
  <pre><code>def var contador as int.
  def var contador2 as int.
  def var contador3 as int.
  
  def temp-table tt-min-oper 
  field it-codigo like operacao.it-codigo
  field num-id-operacao like operacao.num-id-operacao
  field op-codigo like operacao.op-codigo
  .
  
  def temp-table tt-oper 
  field it-codigo like operacao.it-codigo
  field op-codigo like operacao.op-codigo
  .
  
  def temp-table tt-valida-oper 
  field it-codigo like operacao.it-codigo
  .
  
  for each operacao NO-LOCK
  break by operacao.it-codigo by operacao.num-id-operacao:
      IF FIRST-OF (operacao.it-codigo) THEN DO:
          
          CREATE tt-min-oper.
          ASSIGN
          tt-min-oper.it-codigo = operacao.it-codigo
          tt-min-oper.num-id-operacao = operacao.num-id-operacao
          tt-min-oper.op-codigo = operacao.op-codigo
          .
      END.
  END.
  
  FOR EACH tt-min-oper WHERE tt-min-oper.op-codigo &lt;&gt; 10 NO-LOCK:
      create tt-oper.
      assign tt-oper.it-codigo = tt-min-oper.it-codigo.
  END.
  
  
  FOR EACH operacao NO-LOCK,
      EACH tt-oper
      WHERE operacao.it-codigo = tt-oper.it-codigo
      AND operacao.op-codigo = 10 NO-LOCK:
         
          create tt-valida-oper.
          assign
          tt-valida-oper.it-codigo = operacao.it-codigo.
      
  END.
  </code></pre>