Openedge 4gl Display 2 For each?
up vote
0
down vote
favorite
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
add a comment |
up vote
0
down vote
favorite
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
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
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
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
openedge progress-4gl
edited Nov 22 at 3:32
asked Nov 22 at 2:52
Izle
304
304
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
up vote
0
down vote
accepted
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.
No, you can set the placement yourself. See the answer from Mike.
– Jensd
Nov 22 at 11:55
add a comment |
up vote
4
down vote
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.
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
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.
No, you can set the placement yourself. See the answer from Mike.
– Jensd
Nov 22 at 11:55
add a comment |
up vote
0
down vote
accepted
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.
No, you can set the placement yourself. See the answer from Mike.
– Jensd
Nov 22 at 11:55
add a comment |
up vote
0
down vote
accepted
up vote
0
down vote
accepted
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.
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.
answered Nov 22 at 5:46
TheDrooper
752139
752139
No, you can set the placement yourself. See the answer from Mike.
– Jensd
Nov 22 at 11:55
add a comment |
No, you can set the placement yourself. See the answer from Mike.
– Jensd
Nov 22 at 11:55
No, you can set the placement yourself. See the answer from Mike.
– Jensd
Nov 22 at 11:55
No, you can set the placement yourself. See the answer from Mike.
– Jensd
Nov 22 at 11:55
add a comment |
up vote
4
down vote
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.
add a comment |
up vote
4
down vote
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.
add a comment |
up vote
4
down vote
up vote
4
down vote
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.
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.
answered Nov 22 at 5:36
Mike Fechner
2,106714
2,106714
add a comment |
add a comment |
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.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- 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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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