Hi, I registered this forum today. And have a lot of questions. I guess they are so easy for you. My first question ‘How could I use two different display statement in a natural program without calling any other define window or etc. ?’
First Display Statement
Display Name Surname
Second Display Statement
Display Address Age
I tried to write report channel number like following
Display (1) Name Surname
Display (2) Address Age
But it does not work.Could someone help me please…
I’m guessing as to what you intended, but would expect the following to be closer to what you want:
DISPLAY (1) NAME SURNAME
WRITE (1) AGE ADDRESS
This puts the second line of information on the same report as the first. There are more complex possibilities for multi-line output with the DISPLAY statement, but they are not as frequently used.
Natural doesn’t provide automatic support for “group headings” - you have to put them in yourself.
DISPLAY Ad Soyad
/** Subsequently
WRITE "Adres" 51t "Age"
/ "-"(50) 51t "---"
WRITE Adres Age
(I replaced the second DISPLAY with a WRITE not for any functional reason, but simply a matter of style: it indicates to subsequent maintainers that the line is not generating headings)
One more possibility - not quite what you were asking for, but possibly acceptable:
DISPLAY AD / ADRES SOYAD / AGE
This puts AD and ADRES in the same column and SOYAD, AGE in the next column (the DISPLAY statement is column oriented; the WRITE/PRINT statements are line oriented). Headings will be on top of the column, not in the data report area.
You cannot have Natural create this type of output for you (see code below) unless you generate separate reports. Natural takes its column headers from the physically first DISPLAY statement in a program. Thus, you get the headers Ad and Soyad.
You could use a WRITE statement to generate your Adress and Age headers. Something like:
WRITE 5T ‘Adress’ 40t ‘Age’ / 5t ‘-’ (50) or something like that, the numbers are probably not appropriate to your data.
Then you could WRITE Adress Age.
I will recommend something I mention to all newbies. This is BASIC Natural stuff. You have apparently not had any Natural education, and probably do not have Natural manuals. Tell management you NEED this, because you do.
steve
If we run this program, the output will be like following
Ad Soyad
Mehmet Duran
Yuz Street 16
But this output is not suitable for me. I wanna see an output like that.
DEFINE DATA LOCAL
1 AD (A10) INIT <'Mehmet'>
1 SOYAD (A15) INIT <'Duran '>
1 ADDRESS (A50) INIT <'Yuz Street'>
1 AGE (N3) INIT <16>
END-DEFINE
FOR AGE = 16 TO 20
DISPLAY AD
SOYAD
// ADDRESS
' '
// '//AGE' AGE
WRITE '-'(75)
END
I added the FOR loop to show what multiple records would look on a report and the WRITE ‘-’(75) to separate the records. This looks like:
AD SOYAD
ADDRESS AGE
---------- -------------------------------------------------- ----
Mehmet Duran
Yuz Street 16
---------------------------------------------------------------------------
Mehmet Duran
Yuz Street 17
---------------------------------------------------------------------------
Mehmet Duran
Yuz Street 18
---------------------------------------------------------------------------
Something closer to what you want, but much more complex:
FOR AGE = 16 TO 20
DISPLAY AD
'SOYAD' SOYAD
// 'ADDRESS'
/ '-'(50)
/ '/' ADDRESS
' '
// 'AGE'
/ '-'(3)
/ '/' AGE (SG=OFF)
WRITE '-'(75)
END
Looks like this when run:
AD SOYAD
---------- --------------------------------------------------
Mehmet Duran
ADDRESS AGE
-------------------------------------------------- ---
Yuz Street 16
---------------------------------------------------------------------------
Mehmet Duran
ADDRESS AGE
-------------------------------------------------- ---
Yuz Street 17
---------------------------------------------------------------------------
Mehmet Duran
ADDRESS AGE
-------------------------------------------------- ---
Yuz Street 18
---------------------------------------------------------------------------
If you really want to stretch your skill set, check out WRITE USING FORM.