7 27 3 DISPLAY Examples

LANSA Technical

7.27.3 DISPLAY Examples

Example 1: Display fields #ORDNUM, #CUSTNUM and #DATEDUE to the user.

DISPLAY    FIELDS(#ORDNUM #CUSTNUM #DATEDUE)
 

or, identically:

GROUP_BY   NAME(#ORDERHEAD) FIELDS(#ORDNUM #CUSTNUM #DATEDUE)
DISPLAY    FIELDS(#ORDERHEAD)
 

both use default values for all parameters and field attributes and thus would cause a screen something like this to be designed automatically:

      

     Order number :      99999999                           

     Customer no  :      999999                             

     Date due     :      99/99/99                           

 

Example 2: Modify the previous example to design the screen across ways and use column headings to identify the fields:

GROUP_BY   NAME(#ORDERHEAD) FIELDS(#ORDNUM #CUSTNUM #DATEDUE)
DISPLAY    FIELDS(#ORDERHEAD) DESIGN(*ACROSS) IDENTIFY(*COLHDG)
 

which would cause a screen something like this to be designed automatically:

 

     Company        Order           Date                          

     Order          Customer        Order                         

     Number         Number          Due                           

     99999999       999999          99/99/99                      

 

Example 3: Display #ORDNUM #CUSTNUM and #DATEDUE and also specify specific positions and identification methods as field attributes.

For details of field attributes, refer to Field Attributes and their Use.

When specific positions for a field are nominated the automatic design facility is effectively "disabled".

GROUP_BY NAME(#ORDERHEAD) FIELDS((#ORDNUM  *COLHDG *L3 *P3 ) (#CUSTNUM *LABEL  *L3 *P24) (#DATEDUE *NOID   *L7 *P37))
 
DISPLAY  FIELDS(#ORDERHEAD) DESIGN(*ACROSS) TEXT(('--DATE--' 6 37) ('--------' 8 37))
 

which would cause a screen something like this to be designed:

 

     Company              Customer no  : 999999                  

     Order                                             

     Number                                            

     99999999                                          --DATE-- 

                                                       99/99/99 

                                                       -------- 

 

Note: The manual specification of row and column numbers and "text" is not required. The screen design facility can be used to modify an "automatic" design much more quickly and easily. Refer to The Screen Design Facility in the LANSA for i User Guide for details of how to use the screen design facility.

After the screen design facility has been used on a DISPLAY command the associated FIELDS parameter (in the DISPLAY or GROUP_BY command) will be automatically re-written with the required row, column and method of identification attributes. Remember, if an expandable group expression was used, LANSA will substitute the expression with the fields that constitute it.

In addition the TEXT parameter of the DISPLAY command will also be automatically re-written.

Example 4: Display the order header details used in the previous example and all the associated invoice lines nominated in a list named #ORDERLINE:

GROUP_BY   NAME(#ORDERHEAD) FIELDS(#ORDNUM #CUSTNUM #DATEDUE)
DEF_LIST   NAME(#ORDERLINE) FIELDS(#ORDLIN #PRODUCT #QUANTITY #PRICE)

DISPLAY    FIELDS(#ORDERHEAD) BROWSELIST(#ORDERLINE)
 

Since default values were used for all parameters and no field attributes were specified a screen something like this would be designed automatically:

 

     Order number : 99999999                          

     Customer no  : 999999                            

     Date due     : 99/99/99                          

                                                   

     Line                                              

     No   Product Quantity Price                      

     99   9999999  99999  99999.99                    

     99   9999999  99999  99999.99                    

     99   9999999  99999  99999.99                    

     99   9999999  99999  99999.99                    

     99   9999999  99999  99999.99                    

     99   9999999  99999  99999.99                    

 

Example 5: Display the order header details used in the previous example and all the associated invoice lines nominated in a list named #ORDERLINE which only has 4 entries. Display invoice line totals (which can be adjusted) below the invoice lines:

GROUP_BY   NAME(#ORDERHEAD) FIELDS(#ORDNUM #CUSTNUM #DATEDUE)
DEF_LIST   NAME(#ORDERLINE) FIELDS(#ORDLIN #PRODUCT #QUANTITY #PRICE)
DISPLAY    FIELDS(#ORDERHEAD) BROWSELIST(#ORDERLINE 4) OPTIONS(*NOREAD)
REQUEST    FIELDS(#TOTQTY #TOTPRICE) OPTIONS(*OVERLAY)
 

after screen painting to adjust the field positions to avoid overlapping, the resulting screen (after executing the above code) would look something like this:

 

     Order number : 99999999                           

     Customer no  : 999999                             

     Date due     : 99/99/99                           

                                                    

     Line                                              

     No   Product Quantity Price                       

     99   9999999  99999  99999.99                     

     99   9999999  99999  99999.99                     

     99   9999999  99999  99999.99                     

     99   9999999  99999  99999.99                     

                                                    

     Total Qty    : 9999999                            

     Total Price  : 9999999.99                         

 

Example 6 : Use an expandable group expression and redesign the layout using the screen design facility:

GROUP_BY   NAME(#XG_ORDHDG) FIELDS(#ORDNUM #CUSTNUM #DATEDUE)
DISPLAY    FIELDS(#XG_ORDHDG) DESIGN(*ACROSS) IDENTIFY(*COLHDG)
 

The screen designed automatically would look like this:

 

             Company   Order     Date                                  

             Order     Customer  Order                                 

             Number    Number    Due                                   

             99999999  999999    99/99/99                              

                   

If the layout is changed using the screen design facility to look like this:

 

            Company   Order                                          

            Order     Customer                                        

            Number    Number                                        

            99999999  999999       Date Order Due : 99/99/99         

 

then the DISPLAY command FIELDS parameter will be expanded as follows:

DISPLAY    FIELDS((#ORDNUM *L2 *P3) (#CUSTNUM *L2 *P37) (#DATEDUE *L5 *P26 *LAB)) DESIGN(*ACROSS) IDENTIFY(*COLHDG)