ABL Progress 4gl : For Each with Count in Output-Stream

Discussão em 'StackOverflow' iniciado por fdantas, Agosto 31, 2017.

  1. fdantas

    fdantas Administrator Moderador

    Progress-Procedure-Editor:

    DEFINE STREAM myStream.

    OUTPUT STREAM myStream TO 'C:\Temp\BelegAusgangSchnittstelle.txt'.

    FOR EACH E_BelegAusgang
    WHERE E_BelegAusgang.Firma = '000'
    AND E_BelegAusgang.Schnittstelle = '$Standard'
    NO-LOCK:

    PUT STREAM myStream UNFORMATTED
    STRING(E_BelegAusgang.Firma)
    '|'
    STRING(E_BelegAusgang.BelegNummer)
    '|'
    STRING(E_BelegAusgang.Schnittstelle)
    '|'
    SKIP
    .
    END.


    I get this (extraction):

    Firma | BelegNr | Schnittstelle

    000 | 3 | $Standard

    000 | 3 | $Standard

    000 | 3 | $Standard

    000 | 3 | $Standard

    000 | 3 | $Standard

    000 | 8 | $Standard

    000 | 8 | $Standard



    What I need is to COUNT the BelegNr. So I import the data of the TXT to SQL Server.

    On Server my query is:

    SELECT [BelegNr]
    ,COUNT(*) AS [Anzahl]
    FROM [TestDB].[dbo].[Beleg_Ausgang]
    GROUP BY [BelegNr]
    ORDER BY [Anzahl]


    With that query I got (extraction):

    BelegNr Anzahl

    3 | 5



    8 | 2

    Is there a way to put the COUNT directly into the Progress-Code? I mean, I want my result directly from the Progress-Procedure-Editor.

    Continue reading...

Compartilhe esta Página