Difference between revisions of "Lesson 5"
Line 78: | Line 78: | ||
...S ZD4=^ZZLIB3(ZS4) | ...S ZD4=^ZZLIB3(ZS4) | ||
...W "<TR>",! | ...W "<TR>",! | ||
− | ...W "<TD>",ZS4,"</TD>","<TD>",$P(ZD4,"^",2),"</TD>" | + | ...W "<TD>",ZS4,"</TD>","<TD>",$P(ZD4,"^",2),"</TD>" |
+ | ...W "<TD>",$P(ZD4,"^",1),"</TD>",! | ||
...W "</TR>",! | ...W "</TR>",! | ||
W "</TABLE>",! | W "</TABLE>",! | ||
Line 97: | Line 98: | ||
...S ZD4=^ZZLIB3(ZS4) | ...S ZD4=^ZZLIB3(ZS4) | ||
...W "<TR>",! | ...W "<TR>",! | ||
− | ...W "<TD>",ZS4,"</TD>","<TD>",$P(ZD4,"^",2),"</TD>" | + | ...W "<TD>",ZS4,"</TD>","<TD>",$P(ZD4,"^",2),"</TD>" |
+ | ...W "<TD>",$P(ZD4,"^",1),"</TD>",! | ||
...W "</TR>",! | ...W "</TR>",! | ||
W "</TABLE>",! | W "</TABLE>",! | ||
Line 137: | Line 139: | ||
The third table again goes through the process using the "C" cross reference, in this case sorted by first name. | The third table again goes through the process using the "C" cross reference, in this case sorted by first name. | ||
+ | |||
+ | Prev: [[Lesson 4]] | ||
+ | Next: [[Lesson 6]] |
Revision as of 18:25, 10 October 2006
Linux / Apache / GT.M / Web Application Lesson 5
In Lesson 5 we are going use the global ^ZZLIB3 that we produced in lesson 4 to create three web tables. Table 1 will list the names by index number, Table 2 will list the names by last name, Table 3 will list the names by first name.
I realize that this is a touchy situation but I have again listed the cgi script that I used to make this work. Please use one similar to one that you have already working, only change the routine to ZZLIB5, if that is what you chose to name your routine for this lesson.
library.sh5 ------------------------------------------------------------------------- #!/bin/sh cd /usr/local/gtm/VISTA export gtm_dist=/usr/local/gtm export gtmroutines="$gtm_dist/VISTA/uo($gtm_dist/VISTA/ur) $gtm_dist" export gtmgbldir=/usr/local/gtm/VISTA/mumps.gld export PATH=$PATH:$gtm_dist mumps -run ZZLIB5 -------------------------------------------------------------------------
The global that I used is the ^ZZLIB3 global as shown below.
^ZZLIB3 ------------------------------------------------------------------------- ^ZZLIB3(0)="4^4" ^ZZLIB3(1)="IRWIN^BENJAMIN" ^ZZLIB3(2)="FLINTSTONE^FRED" ^ZZLIB3(3)="JETSON^GEORGE" ^ZZLIB3(4)="FLINTSTONE^FRED" ^ZZLIB3("B","FLINTSTONE","FRED",2)="" ^ZZLIB3("B","FLINTSTONE","FRED",4)="" ^ZZLIB3("B","IRWIN","BENJAMIN",1)="" ^ZZLIB3("B","JETSON","GEORGE",3)="" ^ZZLIB3("C","BENJAMIN","IRWIN",1)="" ^ZZLIB3("C","FRED","FLINTSTONE",2)="" ^ZZLIB3("C","FRED","FLINTSTONE",4)="" ^ZZLIB3("C","GEORGE","JETSON",3)="" -------------------------------------------------------------------------
The routine that I used to produce the web table follows.
ZZLIB5 ------------------------------------------------------------------------- ZZLIB5 ; ROUTINE TO CREATE A WEB PAGE USING THE ^ZZLIB3 GLOBAL. ; ; W "Content-type: text/html",!! W "<html>",! W "<head>",! W "<title>ZZLIB3 GLOBAL LISTS.</title>",! W "</head>",! W "<body>",! ;W "
",! W "
INDEX | FIRST NAME | LAST NAME | ",! W "
---|---|---|
",ZS1," | ","",$P(ZD1,"^",2)," | ","",$P(ZD1,"^",1)," | ",! .W "
;W "
",! W "
INDEX | FIRST NAME | LAST NAME | ",! W "
---|---|---|
",ZS4," | ","",$P(ZD4,"^",2)," | " ...W "",$P(ZD4,"^",1)," | ",! ...W "
;W "
",! W "
INDEX | FIRST NAME | LAST NAME | ",! W "
---|---|---|
",ZS4," | ","",$P(ZD4,"^",2)," | " ...W "",$P(ZD4,"^",1)," | ",! ...W "
; W "</body>",! W "</html>",! ; Q -------------------------------------------------------------------------
I called it by entering the following line into the web browser.
------------------------------------------------------------------------- http://10.0.1.209/cgi-bin/library.sh5 -------------------------------------------------------------------------
The following is an explanation of the process.
Almost every opening web tag requires a closing web tag. The paragraph tagis an exception, but I used a closing tag here just to make my routine look good. Each table section starts with a new paragraph tag <P>, and ends with a end paragraph tag
. Each table starts with a table tagI placed headers at the top of the table using the start table row tag <TR> and ended the header section with a end table row tag (/TR>.
Within the table row tags, I identified each table header by a start table header tag <TH> and a end table header tag </TH>.
The next section I start moving through the mumps global using the $O function. For the names listed by index number, table 1, I start by setting ZS1=0. Within the F(or) loop I use the $O function to move the value of ZS1 to the value in the global just after the previous value. The first time through the loop that would now make ZS1=1.
Then I place the data that is at ^ZZLIB3(1) equal to ZD1. I use the numeric value of ZS1, in the first loop that would be the number 1, and write it between table data tags, <TD> and </TD>.
Then I use the $P(iece) function to get the second piece of data from ZD1, first name, and place it between table data tags, <TD> and </TD>.
Then I use the $P(iece) function to get the first piece of data from ZD1, last name and place it between table data tags, <TD> and </TD>.
The second table goes through the same process, just a deeper array structure that is sorted by last name. The "B" cross reference.
The third table again goes through the process using the "C" cross reference, in this case sorted by first name.
Prev: Lesson 4 Next: Lesson 6