M2Web Tutorials

From VistApedia
Revision as of 12:57, 11 October 2006 by Kdtop (talk | contribs)
Jump to: navigation, search

Back to M2Web Overview

Jim Self said...

I have a different set of utilities in M2Web (see http://vista.vmth.ucdavis.edu/rtn/view*) for traversing and processing records defined by Fileman (or otherwise). These make use of ^iterator and variable names derived from Fileman field labels to make extremely concise yet readable processing specifications. Using these utilities makes applications routines, smaller, simpler, more readable, and often more general also.

- example: http://vista.vmth.ucdavis.edu/query/?dbfile=19&index=Name&format=OptnNo;Name;MenuText

This

* index=Name specifies iteration over the "B" index of file 19 (OPTION). 
* "OptnNo" is the variable name for the (IEN) of this file
    so "index=OptnNo" would specifiy iteration over the IEN. 
* "find" Optional parameter -- further refine the iteration.
* "filter" Optional parameters -- further refine the iteration.
* "format=OptnNo;Name;MenuText" is optional. 
   It specifies 3 output fields per data record. 
   Default output is an HTML table but many other possibilities 
     are readily available.

...

Web requests handled by M2Web start MUMPS execution with the routine ^htCGI ( http://vista.vmth.ucdavis.edu/rtn/htCGI ). This routine and helpers handle the basic HTTP/CGI request/response cycle.

The HTTP headers are processed into local array htCGI(headerName)=value by routine ^htCGI1 ( http://vista.vmth.ucdavis.edu/rtn/htCGI1 ) and named inputs are processed into local array htInput(inputName)=value by routine ^htCGI2.

Additional ht* local variables are defined in ^htCGI1 that provide concise reference to the context and character of each given request.

When an application handler starts up, it will find the inputs in local array htInput. From above:

 htInput("dbfile")=19
 htInput("index")="Name"
 htInput("format")="OptNo;Name;MenuText"

Change "query" to "echo" in the URL above to see the two arrays

http://vista.vmth.ucdavis.edu/echo?dbfile=19&index=Name&format=OptnNo;Name;MenuText

This display is provided by routine ^htEcho ( http://vista.vmth.ucdavis.edu/rtn/htEcho ), a simple application handler that illustrates a basic HTML and CGI response. It can be a useful tool for basic diagnostics when developing a new application.