6.4. CGI File

A file with extension “.cgi” (“fjdclr.cgi”) contains “cgi” coding to form the query expression correctly and pass on to WWWISIS. It uses the assigned tags, which contain the values keyed-in, and the selected options by the user using the “Guided-Search” HTML file. It also specifies the name of the database, the search expression, print format to be used, records per page to be displayed, and epilog file to process at the end.

  Database - clair
  Records/page - 20
  Print display format - clairh.pft for Full record display
cita.pft for Citation/short record display
  Epilog file - clair.epi for Full record
cita.epi for Citation

The listing of this file is as follows:

'db=clair'/,
(if v2001^n='first' then 'h1='v2001^v/'h2='f(val(v2001^v)+19,0,0) fi,
if v2001^n='bool' then 'bool='v2001^v fi/)
if not v2001^n:'bool' then 'h1=1'/'h2=20'/
  bool=', if v6010<>'' then
 

  else  

"("v6001 v6002 v6003 v6004 v6005 v6006 v6007 v6008 v6009 v6010 v6011
    if v6007<>'' then
      "("v6001 v6002 v6003 v6004 v6005 v6006 v6007 v6008
    "("v6001 v6002 v6003 v6004 v6005>
      if v6004 <>'' then
        "("v6001 v6002 v6003 v6004 v6005
      else
        "("v6001 v6002
      fi
    fi
 

  fi/, 

 
fi
'pft=@clairh.pft'/,
if v6014='Citation' or v6016='Next 20 Records' then
  'pft=@cita.pft'/,
  'epilog=@cita.epi'
else  
  'pft=@clairh.pft'/,
  'epilog=@clair.epi'
fi  

To understand the above coding it is necessary to know “val”, “f” and “if” functions.

val(format expr)

Returns the numeric value of the argument generated by format expr

Ex:
val(‘45’) the output is the value 45

f(format expr, expr-1, expr-2)

Converts a numeric value to string. Format expr is the numeric expression to be converted. expr-1 and expr-2 are optional and determine the minimum output length and the number of decimal places respectively.

Note:
  If expr-2 is set, expr-1 must also be coded.
If only expr-1 is defined, the result is in scientific exponent notation!
Ex:
  f(val(‘123.456’),0,0)    result is    123
f(val(‘123.456’),0,2)    result is    123.46
f(val(‘123’)+1,0,0)       result is    124 (The value is incremented by 1)

if condition then statement1 [else statement2] fi

This is used for selection of statement 1 or statement 2 depending upon the result of the condition (true or false). That is, statements 1 and 2 will not be executed together at any time. If the condition returns true the statement1 and if the condition returns false the statement2 is executed.

Note: [] is used to indicate that the enclosed portions are optional, and need not be coded if it is not required.

6.4.1. Conditional Statements to Display 20 Records/Page

  (if v2001^n='first' then 'h1='v2001^v/'h2='f(val(v2001^v)+19,0,0) fi,
  if v2001^n='bool' then 'bool='v2001^v fi/)
  if not v2001^n:'bool' then
    'h1=1'/'h2=20'/
   

|
|
|

  fi

In the beginning v2001^n will not hold any value, as it has not been set. That is, it is not equivalent to the word either ‘first’ or ‘bool’. As a result the first two if conditions return false and the third if condition if not v2001^n:'bool' returns true there by its then statements execute.

h1= 1
h2= 20
(h1 and h2 are Boolean expression related environment parameters of WWWISIS. h1=<hit number> – first hit; h2=<hit number> - last hit)

In the beginning v2001^n will not hold any value, as it has not been set. That is, it is not equivalent to the word either ‘first’ or ‘bool’. As a result the first two if conditions return false and the third if condition if not v2001^n:'bool' returns true there by its then statements execute.

h1= 1
h2= 20
(h1 and h2 are Boolean expression related environment parameters of WWWISIS. h1=<hit number> – first hit; h2=<hit number> - last hit)

The search terms and Boolean operators forming the query is extracted from tags 6001 to 6011 and passed on to WWWISIS and retrieves first 20 query-matched (This is explained later under section 6.4.2 “Conditional Statements for Query Parameters”). To display rest of the records, when push button “Next 20 Record” is clicked the following conditional statements in the epilog file execute (Note: none of the statements in the condition if val(v1002)>val(v1032) execute until the click of “Next 20 Record” push button).

  if val(v1002)>val(v1032) then
    <form action="/scripts/wwwi32.exe/[in=fjdclr.in]/" method="post">'/
'<input type=hidden name="first" value="',f(val(v1032)+1,0,0), '">'/
'<input type=hidden name="bool" value="', v1021,'">'/
   

|
|
|

  fi

if val(v1002)>val(v1032):

Tag 1002 is designated in WWWISIS to contain the total number of records retrieved for the query. Tag 1032 contains 20, the maximum records per page if the number of records retrieved is more than 20.

The above checks whether the value of total records tag 1002 is greater than the value of last “mfn” tag 1032. For example if the total retrieved records are 35 then v1002 = 35 and v1032 = 20 (If the matched records are greater than 20 then always the last “mfn” tag1032 equals to 20), the condition returns true and one by one the then statements execute.

First '<input type=hidden name="first" value="',f(val(v1032)+1,0,0), '">'/ executes, making the “tcg” defined tag 2001 in “.cgi” to have the following values.

v2001^n = first
v2001^v = 21 (Tag 1032 has 20 which gets +1)

Secondly the above values pass to “fjdclr.cgi” and make the following condition in the “cgi” file to execute (if v2001^n='first' then 'h1='v2001^v / 'h2='f(val(v2001^v)+19,0,0) fi

h1=21
h2=40 (21+19)

Next, the code '<input type=hidden name="bool" value="', v1021,'">'/ in the epilog file executes, making

v2001^n = bool
v2001^v = The Boolean expression (query)

For instance the query may be ‘information and retriev$’)

Thereafter if v2001^n='bool' then 'bool='v2001^v fi/) executes

bool = The Boolean expression (query) - That is
bool = information and retriev$

which passes the same query and retrieves another set of 20 query-matched records (ex: 21 to 40; 41-60; 61-80 …….. ).

Next if not v2001^n:'bool' in the “cgi” executes; here condition returns false therefore none of the then statements execute.

Note:
The above described functions and codes are executed repeatedly until the last query- matched record is found.

6.4.2. Conditional Statements for Query Formulation

'bool=', if v6010<>' ' then
"("v6001 v6002 v6003 v6004 v6005 v6006 v6007 v6008 v6009 v6010 v6011
else
if v6007<>' ' then
"("v6001 v6002 v6003 v6004 v6005 v6006 v6007 v6008
else
if v6004 <>' ' then
"("v6001 v6002 v6003 v6004 v6005
else
"("v6001 v6002
fi
fi
fi/,

>This is the major unit of the “fjdclr.cgi”. As explained before the user can give either single or multiple queries to search the database. In the “Guided Search” there are 4 query boxes. For each query box one field selection drop-down menu, and 3 boolean operator drop-down menus are set up. At one particular time the user can use all available combinations or either one or more combinations. But during the execution each text box entry and drop-down menu selection are stored in the assigned tag value (“tagXXXX”) and interpreted as parameter from “cgi” to WWWISIS. When these are interpreted appropriate entries should be sent, in other words, the tags that contain null should not be interpreted.

Therefore the first condition checks for the tag 6010 (query box 4) to be empty or not as follows

if v6010<>' ' then

if it is not empty then the then statement of the above condition interprets but if it is empty following condition checks whether the tag 6007 (query box 3) is empty or not:

if v6007<>' ' then

if it is not empty then the then statement of the above condition interprets but if it is empty the following condition checks whether the tag 6004 (query box 2) is empty or not:

if v6004 <>' ' then

if it is not empty then the then statement of the above condition interprets but if it is empty  the following is passed on directly.

"("v6001 v6002

Let us see the executable (then) statement, for example take the "("v6001 v6002 v6003 v6004 v6005 statement. Here 5 tags are combined together. Each of them may hold different values. For example if the following is the given query

then query is stored in the tags as follows

     (        v6001         v6002         v6003         v6004           v6005
       

            informat$         )                or (              2000            /(260))

                

        Keyed in          For All        For OR        Keyed in    Field Limiter
         Query Word     Field          Operator     Query Word     For Year

Finally it is produced as "("v6001 v6002 v6003 v6004 v6005, which is equivalent to (informat$)or ( 2000 /(260))

6.4.3. Conditional Statements for Display Type

if v6014='Citation' or v6016='Next 20 Records' then
'pft=@cita.pft'/,
'epilog=@cita.epi'
else
'pft=@clairh.pft'/,
'epilog=@clair.epi'
fi

The “Citation” and the “Full Record” are the offered display types for the users to view the retrieved records. “Citation” outputs are brief and “Full Record” outputs are detailed. To generate two different outputs two different sets of “pft” and epilog files are used. (“cita.pft” and “cita.epi” are for “Citation” and “clairh.pft” and “clair.epi” are for “Full Record”). To do this the display type selected by the user is to be checked.

First of all to check the selected type, a tag should be created to store the type using the following HTML-code

<select name="tag6014" size=1>
<option value="Full">Full Record</option>
<option value="Citation">Citation</option>
</select>

One more important point to be considered here is, since the records are displayed 20 per page the same display type should be continued for each page till the end. (Note: after each click of “Next 20 Record” button the display type should be checked.) Therefore in the “cita.epi” file the following code has been included to do this.

if val(v1002)>val(v1032) then
'<input type=submit name="tag6016" value="Next 20 Records" >'/
fi

For example if the “Citation” is the selected display type then tag 6014 equals to the word ‘Citation’. At this time if the condition if v6014='Citation' or v6016='Next 20 Records' is checked, it returns true and the then statements execute, resulting in displaying the first 20 records. (Note this 6014 = Citation is valid to display first 20 records)

Note:
Since the expression ‘epilog=@cita.epi’ is included as one of the then statements, all the statements in the epilog file are executed. This means the statement explained earlier executes therefore v6016 equals to the word ‘Next 20 Record’ (when each time the epilog file is executed the value of tag 6016 equals to the word ‘Next 20 Record’ this is valid till the end of display).

To display the rest of the records, in the “Citation” display type, if the same condition is checked, it returns true, (because now onwards v6016 is equals to the word ‘Next 20 records’ so condition v6016='Next 20 Records' always returns true) and the same then statements execute. This displays all the retrieved records in the same display type.

In the case of “Full Record” display type the v6014 equals to the word ‘Full Record’, at this time, if the condition is checked, it returns false and the given else statements execute. This process displays the first 20 records in “Full Record” display type. As explained earlier 6014 = ‘Full Record’ is valid to display first 20 records, even though for the rest of the records the display type is the same. The reason is neither v6014 or v6016 equals to ‘Citation’ nor ‘Next 20 Records’. Therefore the condition returns false and directly else statements are executed.

Previous | Next

1