Is there a way of using an IF statement inside a FOR EACH in PROGRESS-4GL?

Discussão em 'StackOverflow' iniciado por fdantas, Dezembro 15, 2020.

  1. fdantas

    fdantas Administrator Moderador

    I'm transforming some SQL codes into Progress 4GL. The specific code I'm writing right now has a lot of possible variables insertions, for example, there are 3 checkboxes that can be selected to be or not, and each selection adds a "AND ind_sit_doc IN", etc.

    What I'd like to do is something like this:

    FOR EACH doc-fiscal USE-INDEX dctfsc-09
    WHERE doc-fiscal.dt-docto >= pd-data-1
    AND doc-fiscal.dt-docto <= pd-data-2
    AND doc-fiscal.cod-observa <> 4
    AND doc-fiscal.tipo-nat <> 3
    AND doc-fiscal.cd-situacao <> 06
    AND doc-fiscal.cd-situacao <> 22
    AND (IF pc-ind-sit-doc-1 = 'on' THEN: doc-fiscal.ind-sit-doc=1) NO-LOCK,
    EACH natur-oper USE-INDEX natureza
    WHERE doc-fiscal.nat-operacao = natur-oper.nat-operacao NO-LOCK:


    The if part would only be read if the variable was in a certain way. Is it possible?

    Continue reading...

Compartilhe esta Página