How to put different types of ‘records‘ into a table (RPG)

Please mark posts as being for RPG or RDMLX (LANSA) developers.
To subscribe by email, display this forum, scroll to the end and select ‘Subscribe Forum’.
Post Reply
MarkDuignan
Posts: 346
Joined: Wed Apr 18, 2012 10:33 am

How to put different types of ‘records‘ into a table (RPG)

Post by MarkDuignan »

This is the simplest way to do this – there are much more elaborate things that can also be done.

A minor modification is made to the shipped RPG building block program DETAILER3 (see file QRPGLESRC in your LongRange project library or in library LRNG_PROJ) ........ it puts differently formatted data into Column2 and column 5 for odd and even lines:

Code: Select all

             
             // For COLUMN 2 alternate the content to make multi-lines in the display
             
             If (Details.OddRow);
                Details.Col2Value = 'BBBBBBBBBBBBB';
             Else;
                Details.Col2Value = 'XXXXXXXXXXXXXXXXX'
                          + X'0D' + 'YYYYYYY'
                          + X'0D' + '4848494948383';
             Endif;
  
             // Do the same with COLUMN 5 to show multiline date
    
             If ( NOT(Details.OddRow) );
                Details.Col5Value = 'EEEEEEEEEEEEE';
             Else;
                Details.Col5Value = 'QQQQQQQQQQQQQQQQQQQ'
                          + X'0D' + 'TTTTTTT'
                          + X'0D' + '(02)-748489474';
             Endif;

This produces something like a 5250 multi-line subfile – but it’s a lot more flexible because only some records have extra lines ...
Detailer3.png
Detailer3.png (115.24 KiB) Viewed 3512 times
In a real application this would be something like

Code: Select all

                Details.IdentityCol = %trimr(NAME)
                          + X'0D' + %trimr(ADDRESS1)
                          + X'0D' + %trimr(ADDRESS2);

                If (PHONEBUS <> ‘ ‘);
                  Details.IdentityCol += X'0D' + ‘Business Phone : ’+ %trimr(PHONEBUS);  
                Endif;                

                If (PHONEHOME <> ‘ ‘);
                  Details.IdentityCol += X'0D' + ‘Home Phone : ’+ %trimr(PHONEHOME);  
                Endif
So that some records get 3 lines, some get 4 and some get 5.

You can also see carriage returns and small fonts being used in the shipped ‘Incidents’ demonstration application here ........
History.png
History.png (77.9 KiB) Viewed 3512 times
The date and time are separated by carriage returns and use a much smaller font.
See shipped RPG program DEMOINCI3 in source file LRNG_DEMO/SOURCEDEMO.
MarkDuignan
Posts: 346
Joined: Wed Apr 18, 2012 10:33 am

Re: How to put different types of ‘records‘ into a table (RP

Post by MarkDuignan »

This example is now shipped with LongRange.
See http://longrange.lansa.com.au/viewtopic.php?f=13&t=111
Post Reply