Openedge 4gl Display 2 For each?












0















Let's say I have 2 for each statement with 2 none related table
The first one is



for each table-1 
disp table-1.col1
table-1.col2.
end.

for each table-2
disp table-2.col1
table-2.col2.
end.


and it displays to me like this



table-1.col1 table-1.col2 
table-1.col1 table-1.col2
table-1.col1 table-1.col2

table-2.col1 table-2.col2
table-2.col1 table-2.col2
table-2.col1 table-2.col2


I would like it to display like this



---------- Table 1 ---------      ---------- Table 2 --------
|table-1.col1 table-1.col2 | |table-2.col1 table-2.col2|
|table-1.col1 table-1.col2 | |table-2.col1 table-2.col2|
|table-1.col1 table-1.col2 | |table-2.col1 table-2.col2|


How to do that ?










share|improve this question





























    0















    Let's say I have 2 for each statement with 2 none related table
    The first one is



    for each table-1 
    disp table-1.col1
    table-1.col2.
    end.

    for each table-2
    disp table-2.col1
    table-2.col2.
    end.


    and it displays to me like this



    table-1.col1 table-1.col2 
    table-1.col1 table-1.col2
    table-1.col1 table-1.col2

    table-2.col1 table-2.col2
    table-2.col1 table-2.col2
    table-2.col1 table-2.col2


    I would like it to display like this



    ---------- Table 1 ---------      ---------- Table 2 --------
    |table-1.col1 table-1.col2 | |table-2.col1 table-2.col2|
    |table-1.col1 table-1.col2 | |table-2.col1 table-2.col2|
    |table-1.col1 table-1.col2 | |table-2.col1 table-2.col2|


    How to do that ?










    share|improve this question



























      0












      0








      0








      Let's say I have 2 for each statement with 2 none related table
      The first one is



      for each table-1 
      disp table-1.col1
      table-1.col2.
      end.

      for each table-2
      disp table-2.col1
      table-2.col2.
      end.


      and it displays to me like this



      table-1.col1 table-1.col2 
      table-1.col1 table-1.col2
      table-1.col1 table-1.col2

      table-2.col1 table-2.col2
      table-2.col1 table-2.col2
      table-2.col1 table-2.col2


      I would like it to display like this



      ---------- Table 1 ---------      ---------- Table 2 --------
      |table-1.col1 table-1.col2 | |table-2.col1 table-2.col2|
      |table-1.col1 table-1.col2 | |table-2.col1 table-2.col2|
      |table-1.col1 table-1.col2 | |table-2.col1 table-2.col2|


      How to do that ?










      share|improve this question
















      Let's say I have 2 for each statement with 2 none related table
      The first one is



      for each table-1 
      disp table-1.col1
      table-1.col2.
      end.

      for each table-2
      disp table-2.col1
      table-2.col2.
      end.


      and it displays to me like this



      table-1.col1 table-1.col2 
      table-1.col1 table-1.col2
      table-1.col1 table-1.col2

      table-2.col1 table-2.col2
      table-2.col1 table-2.col2
      table-2.col1 table-2.col2


      I would like it to display like this



      ---------- Table 1 ---------      ---------- Table 2 --------
      |table-1.col1 table-1.col2 | |table-2.col1 table-2.col2|
      |table-1.col1 table-1.col2 | |table-2.col1 table-2.col2|
      |table-1.col1 table-1.col2 | |table-2.col1 table-2.col2|


      How to do that ?







      openedge progress-4gl






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 22 '18 at 3:32







      Izle

















      asked Nov 22 '18 at 2:52









      IzleIzle

      304




      304
























          2 Answers
          2






          active

          oldest

          votes


















          0














          Since the tables are unrelated you'll have to do some data manipulation to get the side-by-side chart output you're looking for. You can create a "line" temp table that holds the four fields you want to show across each output line. Go through each of the tables, adding the record data to each line. Then go through the line temp table and output the line data.



          DEFINE VARIABLE linecnt AS INTEGER NO-UNDO.

          DEFINE TEMP-TABLE ttLine
          FIELD linenum AS INTEGER
          FIELD tbl1col1 AS CHARACTER
          FIELD tbl1col2 AS CHARACTER
          FIELD tbl2col1 AS CHARACTER
          FIELD tbl2col2 AS CHARACTER
          INDEX Idx1 IS PRIMARY linenum.

          linecnt = 1. /* Initialize the line counter. */

          /* Go thru table-1, creating a ttLine for each record. */
          FOR EACH table-1 NO-LOCK:
          CREATE ttLine.
          ASSIGN
          ttLine.linenum = linecnt
          ttLine.tbl1col1 = table-1.col1
          ttLine.tbl1col2 = table-1.col2
          linecnt = linecnt + 1.
          END.

          linecnt = 1. /* Reset the line counter. */

          /* Go thru table-2, adding data to ttLine and creating new records if necessary. */
          FOR EACH table-2 NO-LOCK:
          FIND FIRST ttLine WHERE ttLine.linenum = linecnt NO-ERROR.
          IF NOT AVAILABLE(ttLine) THEN
          DO:
          CREATE ttLine.
          ttLine.linenum = linecnt.
          END.

          ASSIGN
          ttLine.tbl2col1 = table-2.col1
          ttLine.tbl2col2 = table-2.col2
          linecnt = linecnt + 1.
          END.

          /* Go thru ttLine, output data. */
          OUTPUT TO VALUE("output.txt").

          PUT UNFORMATTED
          "---------- Table 1 --------- ---------- Table 2 --------"
          SKIP.

          FOR EACH ttLine:
          PUT UNFORMATTED
          "|" +
          STRING(ttLine.tbl1col1, "X(12)") + " " + STRING(ttLine.tbl1col2, "X(12)") +
          " | |" +
          STRING(ttLine.tbl2col1, "X(12)") + " " + STRING(ttLine.tbl2col2, "X(12)") +
          "|"
          SKIP.
          END.

          OUTPUT CLOSE.


          The above example should give you the output you're looking for. It will also handle situations where you don't have the same number of records in each table. It will leave blank spaces where there is no data.






          share|improve this answer
























          • No, you can set the placement yourself. See the answer from Mike.

            – Jensd
            Nov 22 '18 at 11:55



















          4














          If you specify the width and col(umn) for the two frames, you can control that they should be displayed next to each other.



          for each Salesrep:                                                                      
          display salesrep.salesrep
          salesrep.repname
          with down frame frm-salesrep
          width 40.
          end.

          for each Item:
          display item.ItemNum
          item.ItemName
          with down frame frm-item
          col 41.
          end.





          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53423219%2fopenedge-4gl-display-2-for-each%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            Since the tables are unrelated you'll have to do some data manipulation to get the side-by-side chart output you're looking for. You can create a "line" temp table that holds the four fields you want to show across each output line. Go through each of the tables, adding the record data to each line. Then go through the line temp table and output the line data.



            DEFINE VARIABLE linecnt AS INTEGER NO-UNDO.

            DEFINE TEMP-TABLE ttLine
            FIELD linenum AS INTEGER
            FIELD tbl1col1 AS CHARACTER
            FIELD tbl1col2 AS CHARACTER
            FIELD tbl2col1 AS CHARACTER
            FIELD tbl2col2 AS CHARACTER
            INDEX Idx1 IS PRIMARY linenum.

            linecnt = 1. /* Initialize the line counter. */

            /* Go thru table-1, creating a ttLine for each record. */
            FOR EACH table-1 NO-LOCK:
            CREATE ttLine.
            ASSIGN
            ttLine.linenum = linecnt
            ttLine.tbl1col1 = table-1.col1
            ttLine.tbl1col2 = table-1.col2
            linecnt = linecnt + 1.
            END.

            linecnt = 1. /* Reset the line counter. */

            /* Go thru table-2, adding data to ttLine and creating new records if necessary. */
            FOR EACH table-2 NO-LOCK:
            FIND FIRST ttLine WHERE ttLine.linenum = linecnt NO-ERROR.
            IF NOT AVAILABLE(ttLine) THEN
            DO:
            CREATE ttLine.
            ttLine.linenum = linecnt.
            END.

            ASSIGN
            ttLine.tbl2col1 = table-2.col1
            ttLine.tbl2col2 = table-2.col2
            linecnt = linecnt + 1.
            END.

            /* Go thru ttLine, output data. */
            OUTPUT TO VALUE("output.txt").

            PUT UNFORMATTED
            "---------- Table 1 --------- ---------- Table 2 --------"
            SKIP.

            FOR EACH ttLine:
            PUT UNFORMATTED
            "|" +
            STRING(ttLine.tbl1col1, "X(12)") + " " + STRING(ttLine.tbl1col2, "X(12)") +
            " | |" +
            STRING(ttLine.tbl2col1, "X(12)") + " " + STRING(ttLine.tbl2col2, "X(12)") +
            "|"
            SKIP.
            END.

            OUTPUT CLOSE.


            The above example should give you the output you're looking for. It will also handle situations where you don't have the same number of records in each table. It will leave blank spaces where there is no data.






            share|improve this answer
























            • No, you can set the placement yourself. See the answer from Mike.

              – Jensd
              Nov 22 '18 at 11:55
















            0














            Since the tables are unrelated you'll have to do some data manipulation to get the side-by-side chart output you're looking for. You can create a "line" temp table that holds the four fields you want to show across each output line. Go through each of the tables, adding the record data to each line. Then go through the line temp table and output the line data.



            DEFINE VARIABLE linecnt AS INTEGER NO-UNDO.

            DEFINE TEMP-TABLE ttLine
            FIELD linenum AS INTEGER
            FIELD tbl1col1 AS CHARACTER
            FIELD tbl1col2 AS CHARACTER
            FIELD tbl2col1 AS CHARACTER
            FIELD tbl2col2 AS CHARACTER
            INDEX Idx1 IS PRIMARY linenum.

            linecnt = 1. /* Initialize the line counter. */

            /* Go thru table-1, creating a ttLine for each record. */
            FOR EACH table-1 NO-LOCK:
            CREATE ttLine.
            ASSIGN
            ttLine.linenum = linecnt
            ttLine.tbl1col1 = table-1.col1
            ttLine.tbl1col2 = table-1.col2
            linecnt = linecnt + 1.
            END.

            linecnt = 1. /* Reset the line counter. */

            /* Go thru table-2, adding data to ttLine and creating new records if necessary. */
            FOR EACH table-2 NO-LOCK:
            FIND FIRST ttLine WHERE ttLine.linenum = linecnt NO-ERROR.
            IF NOT AVAILABLE(ttLine) THEN
            DO:
            CREATE ttLine.
            ttLine.linenum = linecnt.
            END.

            ASSIGN
            ttLine.tbl2col1 = table-2.col1
            ttLine.tbl2col2 = table-2.col2
            linecnt = linecnt + 1.
            END.

            /* Go thru ttLine, output data. */
            OUTPUT TO VALUE("output.txt").

            PUT UNFORMATTED
            "---------- Table 1 --------- ---------- Table 2 --------"
            SKIP.

            FOR EACH ttLine:
            PUT UNFORMATTED
            "|" +
            STRING(ttLine.tbl1col1, "X(12)") + " " + STRING(ttLine.tbl1col2, "X(12)") +
            " | |" +
            STRING(ttLine.tbl2col1, "X(12)") + " " + STRING(ttLine.tbl2col2, "X(12)") +
            "|"
            SKIP.
            END.

            OUTPUT CLOSE.


            The above example should give you the output you're looking for. It will also handle situations where you don't have the same number of records in each table. It will leave blank spaces where there is no data.






            share|improve this answer
























            • No, you can set the placement yourself. See the answer from Mike.

              – Jensd
              Nov 22 '18 at 11:55














            0












            0








            0







            Since the tables are unrelated you'll have to do some data manipulation to get the side-by-side chart output you're looking for. You can create a "line" temp table that holds the four fields you want to show across each output line. Go through each of the tables, adding the record data to each line. Then go through the line temp table and output the line data.



            DEFINE VARIABLE linecnt AS INTEGER NO-UNDO.

            DEFINE TEMP-TABLE ttLine
            FIELD linenum AS INTEGER
            FIELD tbl1col1 AS CHARACTER
            FIELD tbl1col2 AS CHARACTER
            FIELD tbl2col1 AS CHARACTER
            FIELD tbl2col2 AS CHARACTER
            INDEX Idx1 IS PRIMARY linenum.

            linecnt = 1. /* Initialize the line counter. */

            /* Go thru table-1, creating a ttLine for each record. */
            FOR EACH table-1 NO-LOCK:
            CREATE ttLine.
            ASSIGN
            ttLine.linenum = linecnt
            ttLine.tbl1col1 = table-1.col1
            ttLine.tbl1col2 = table-1.col2
            linecnt = linecnt + 1.
            END.

            linecnt = 1. /* Reset the line counter. */

            /* Go thru table-2, adding data to ttLine and creating new records if necessary. */
            FOR EACH table-2 NO-LOCK:
            FIND FIRST ttLine WHERE ttLine.linenum = linecnt NO-ERROR.
            IF NOT AVAILABLE(ttLine) THEN
            DO:
            CREATE ttLine.
            ttLine.linenum = linecnt.
            END.

            ASSIGN
            ttLine.tbl2col1 = table-2.col1
            ttLine.tbl2col2 = table-2.col2
            linecnt = linecnt + 1.
            END.

            /* Go thru ttLine, output data. */
            OUTPUT TO VALUE("output.txt").

            PUT UNFORMATTED
            "---------- Table 1 --------- ---------- Table 2 --------"
            SKIP.

            FOR EACH ttLine:
            PUT UNFORMATTED
            "|" +
            STRING(ttLine.tbl1col1, "X(12)") + " " + STRING(ttLine.tbl1col2, "X(12)") +
            " | |" +
            STRING(ttLine.tbl2col1, "X(12)") + " " + STRING(ttLine.tbl2col2, "X(12)") +
            "|"
            SKIP.
            END.

            OUTPUT CLOSE.


            The above example should give you the output you're looking for. It will also handle situations where you don't have the same number of records in each table. It will leave blank spaces where there is no data.






            share|improve this answer













            Since the tables are unrelated you'll have to do some data manipulation to get the side-by-side chart output you're looking for. You can create a "line" temp table that holds the four fields you want to show across each output line. Go through each of the tables, adding the record data to each line. Then go through the line temp table and output the line data.



            DEFINE VARIABLE linecnt AS INTEGER NO-UNDO.

            DEFINE TEMP-TABLE ttLine
            FIELD linenum AS INTEGER
            FIELD tbl1col1 AS CHARACTER
            FIELD tbl1col2 AS CHARACTER
            FIELD tbl2col1 AS CHARACTER
            FIELD tbl2col2 AS CHARACTER
            INDEX Idx1 IS PRIMARY linenum.

            linecnt = 1. /* Initialize the line counter. */

            /* Go thru table-1, creating a ttLine for each record. */
            FOR EACH table-1 NO-LOCK:
            CREATE ttLine.
            ASSIGN
            ttLine.linenum = linecnt
            ttLine.tbl1col1 = table-1.col1
            ttLine.tbl1col2 = table-1.col2
            linecnt = linecnt + 1.
            END.

            linecnt = 1. /* Reset the line counter. */

            /* Go thru table-2, adding data to ttLine and creating new records if necessary. */
            FOR EACH table-2 NO-LOCK:
            FIND FIRST ttLine WHERE ttLine.linenum = linecnt NO-ERROR.
            IF NOT AVAILABLE(ttLine) THEN
            DO:
            CREATE ttLine.
            ttLine.linenum = linecnt.
            END.

            ASSIGN
            ttLine.tbl2col1 = table-2.col1
            ttLine.tbl2col2 = table-2.col2
            linecnt = linecnt + 1.
            END.

            /* Go thru ttLine, output data. */
            OUTPUT TO VALUE("output.txt").

            PUT UNFORMATTED
            "---------- Table 1 --------- ---------- Table 2 --------"
            SKIP.

            FOR EACH ttLine:
            PUT UNFORMATTED
            "|" +
            STRING(ttLine.tbl1col1, "X(12)") + " " + STRING(ttLine.tbl1col2, "X(12)") +
            " | |" +
            STRING(ttLine.tbl2col1, "X(12)") + " " + STRING(ttLine.tbl2col2, "X(12)") +
            "|"
            SKIP.
            END.

            OUTPUT CLOSE.


            The above example should give you the output you're looking for. It will also handle situations where you don't have the same number of records in each table. It will leave blank spaces where there is no data.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 22 '18 at 5:46









            TheDrooperTheDrooper

            772149




            772149













            • No, you can set the placement yourself. See the answer from Mike.

              – Jensd
              Nov 22 '18 at 11:55



















            • No, you can set the placement yourself. See the answer from Mike.

              – Jensd
              Nov 22 '18 at 11:55

















            No, you can set the placement yourself. See the answer from Mike.

            – Jensd
            Nov 22 '18 at 11:55





            No, you can set the placement yourself. See the answer from Mike.

            – Jensd
            Nov 22 '18 at 11:55













            4














            If you specify the width and col(umn) for the two frames, you can control that they should be displayed next to each other.



            for each Salesrep:                                                                      
            display salesrep.salesrep
            salesrep.repname
            with down frame frm-salesrep
            width 40.
            end.

            for each Item:
            display item.ItemNum
            item.ItemName
            with down frame frm-item
            col 41.
            end.





            share|improve this answer




























              4














              If you specify the width and col(umn) for the two frames, you can control that they should be displayed next to each other.



              for each Salesrep:                                                                      
              display salesrep.salesrep
              salesrep.repname
              with down frame frm-salesrep
              width 40.
              end.

              for each Item:
              display item.ItemNum
              item.ItemName
              with down frame frm-item
              col 41.
              end.





              share|improve this answer


























                4












                4








                4







                If you specify the width and col(umn) for the two frames, you can control that they should be displayed next to each other.



                for each Salesrep:                                                                      
                display salesrep.salesrep
                salesrep.repname
                with down frame frm-salesrep
                width 40.
                end.

                for each Item:
                display item.ItemNum
                item.ItemName
                with down frame frm-item
                col 41.
                end.





                share|improve this answer













                If you specify the width and col(umn) for the two frames, you can control that they should be displayed next to each other.



                for each Salesrep:                                                                      
                display salesrep.salesrep
                salesrep.repname
                with down frame frm-salesrep
                width 40.
                end.

                for each Item:
                display item.ItemNum
                item.ItemName
                with down frame frm-item
                col 41.
                end.






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 22 '18 at 5:36









                Mike FechnerMike Fechner

                2,191714




                2,191714






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53423219%2fopenedge-4gl-display-2-for-each%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

                    SQL update select statement

                    'app-layout' is not a known element: how to share Component with different Modules