Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating report - "multiline variables" as a table

Status
Not open for further replies.

dmazzini

Programmer
Jan 20, 2004
480
US
Creating report - "multiline variables" as a table

Hi guys I have generated a output report (table) based on some data input. I wanted to show data for "multiline variables" as a table.

e.g. varibles might be

$variable= qq(xxx 234
yyy 124
fff 23
12 45);

or

$variable= qq(xxx 234
yyy 124);


$variable = "AAAAAAA";
etc.

I spent a lot of time - whole day - yesterday trying to generate a table like this, where row height grows based dynamically.

Code:
        Parsing Licenses information on 7 sites..
                                                         SITE LICENSES CONFIGURATION
                                                         ---------------------------
  +========== ============  ===============  ===============  =============== ===============  ===============  ===============  ===============+
    SITENAME   TARGET ID     HSDPA 16         HSDPA Pfrp      Channel Cap.    Ant Line         MHA              40W              IMA
                             <State>          <State>         <State/Cap>     <State>          <State/Cap>      <State/Cap>      <State>
  +========== ============  ===============  ===============  =============== ===============  ===============  ===============  ===============+
  |U6FB1129A  |L6074212985  |VALID           |VALID          |VALID 160       |VALID           |MISSING         |MISSING         |VALID         |
  +---------------------------------------------------------------------------------------------------------------------------------------------+
  |U6FB1139A  |L6075011648  |VALID           |VALID          |VALID 160       |VALID           |DELETED 1       |VALID 3         |VALID         |
  |           |             |DELETED         |DELETED        |DELETED 160     |                |DELETED 1       |DELETED 3       |              |
  |           |             |                |               |                |                |VALID 3         |                |              |
  +---------------------------------------------------------------------------------------------------------------------------------------------+
  |U6MD1129E  |L6075134234  |MISSING         |MISSING        |MISSING         |MISSING         |MISSING         |MISSING         |MISSING       |
  +---------------------------------------------------------------------------------------------------------------------------------------------+
  |U6MD1156A  |L6080204921  |VALID           |VALID          |VALID 160       |VALID           |DELETED 1       |VALID 3         |VALID         |
  |           |             |DELETED         |DELETED        |                |DELETED         |DELETED 1       |DELETED 3       |DELETED       |
  |           |             |DELETED         |               |                |                |VALID 3         |DELETED 3       |              |
  +---------------------------------------------------------------------------------------------------------------------------------------------+
  |U9AT0234A  |L6075204822  |VALID           |VALID          |VALID 160       |VALID           |VALID 3         |VALID 3         |VALID         |
  +---------------------------------------------------------------------------------------------------------------------------------------------+
  |U9AT0267B  |L6074935881  |VALID           |VALID          |VALID 160       |VALID           |VALID 3         |VALID 3         |VALID         |
  +---------------------------------------------------------------------------------------------------------------------------------------------+
  |U9AT0457A  |L6074417164  |VALID           |VALID          |VALID 160       |VALID           |VALID 3         |VALID 3         |VALID         |
  +---------------------------------------------------------------------------------------------------------------------------------------------+

Code:
I spent hours trying with printf, sprintf etc...No lucky at all.

Finally I got it using defining a "format" and "write" function. It works perfectly and it produces a nice output,
but I still want to know if there is a nice way to make this format below....or how you guys create nices tables
for multilines variables. As you can see I had to repeat this line...I know about Text::AsciiTable, but I had problem installing it on a *nix machine.

sitename,$target,$l{RAN764LK},$l{RAN849LK},$l{RAN912LK},$l{RAN907LK},$l{RAN905LK},$l{RAN1002LK},$l{RAN1062LK}

Code:
format STDOUT_TOP =
                                                         SITE LICENSES CONFIGURATION
                                                         ---------------------------             
  +========== ============  ===============  ===============  =============== ===============  ===============  ===============  ===============+
    SITENAME   TARGET ID     HSDPA 16         HSDPA Pfrp      Channel Cap.    Ant Line         MHA              40W              IMA             
                             <State>          <State>         <State/Cap>     <State>          <State/Cap>      <State/Cap>      <State>        
  +========== ============  ===============  ===============  =============== ===============  ===============  ===============  ===============+
.
format STDOUT =       
  |^<<<<<<<<< |^<<<<<<<<<<  |^<<<<<<<<<<<<<  |^<<<<<<<<<<<<< |^<<<<<<<<<<<<<  |^<<<<<<<<<<<<<  |^<<<<<<<<<<<<<  |^<<<<<<<<<<<<<  |^<<<<<<<<<<<<<|               
  $sitename,$target,$l{RAN764LK},$l{RAN849LK},$l{RAN912LK},$l{RAN907LK},$l{RAN905LK},$l{RAN1002LK},$l{RAN1062LK}  
~~|^<<<<<<<<< |^<<<<<<<<<<  |^<<<<<<<<<<<<<  |^<<<<<<<<<<<<< |^<<<<<<<<<<<<<  |^<<<<<<<<<<<<<  |^<<<<<<<<<<<<<  |^<<<<<<<<<<<<<  |^<<<<<<<<<<<<<|      
  $sitename,$target,$l{RAN764LK},$l{RAN849LK},$l{RAN912LK},$l{RAN907LK},$l{RAN905LK},$l{RAN1002LK},$l{RAN1062LK}
~~|^<<<<<<<<< |^<<<<<<<<<<  |^<<<<<<<<<<<<<  |^<<<<<<<<<<<<< |^<<<<<<<<<<<<<  |^<<<<<<<<<<<<<  |^<<<<<<<<<<<<<  |^<<<<<<<<<<<<<  |^<<<<<<<<<<<<<|      
  $sitename,$target,$l{RAN764LK},$l{RAN849LK},$l{RAN912LK},$l{RAN907LK},$l{RAN905LK},$l{RAN1002LK},$l{RAN1062LK}
~~|^<<<<<<<<< |^<<<<<<<<<<  |^<<<<<<<<<<<<<  |^<<<<<<<<<<<<< |^<<<<<<<<<<<<<  |^<<<<<<<<<<<<<  |^<<<<<<<<<<<<<  |^<<<<<<<<<<<<<  |^<<<<<<<<<<<<<|     
  $sitename,$target,$l{RAN764LK},$l{RAN849LK},$l{RAN912LK},$l{RAN907LK},$l{RAN905LK},$l{RAN1002LK},$l{RAN1062LK}
~~|^<<<<<<<<< |^<<<<<<<<<<  |^<<<<<<<<<<<<<  |^<<<<<<<<<<<<< |^<<<<<<<<<<<<<  |^<<<<<<<<<<<<<  |^<<<<<<<<<<<<<  |^<<<<<<<<<<<<<  |^<<<<<<<<<<<<<|     
  $sitename,$target,$l{RAN764LK},$l{RAN849LK},$l{RAN912LK},$l{RAN907LK},$l{RAN905LK},$l{RAN1002LK},$l{RAN1062LK}
~~|^<<<<<<<<< |^<<<<<<<<<<  |^<<<<<<<<<<<<<  |^<<<<<<<<<<<<< |^<<<<<<<<<<<<<  |^<<<<<<<<<<<<<  |^<<<<<<<<<<<<<  |^<<<<<<<<<<<<<  |^<<<<<<<<<<<<<|       
  $sitename,$target,$l{RAN764LK},$l{RAN849LK},$l{RAN912LK},$l{RAN907LK},$l{RAN905LK},$l{RAN1002LK},$l{RAN1062LK}
~~|^<<<<<<<<< |^<<<<<<<<<<  |^<<<<<<<<<<<<<  |^<<<<<<<<<<<<< |^<<<<<<<<<<<<<  |^<<<<<<<<<<<<<  |^<<<<<<<<<<<<<  |^<<<<<<<<<<<<<  |^<<<<<<<<<<<<<|    
  $sitename,$target,$l{RAN764LK},$l{RAN849LK},$l{RAN912LK},$l{RAN907LK},$l{RAN905LK},$l{RAN1002LK},$l{RAN1062LK}
  +---------------------------------------------------------------------------------------------------------------------------------------------+   
.
 
close STDOUT;

Cheers



dmazzini
GSM/UMTS System and Telecomm Consultant

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top