O4W Procedures
Create/Modify
From the O4W Procedures Menu choose Create/Modify.
You can either select an existing O4W stored procedure to edit or enter the name of a new stored procedure in the textbox provided. Stored procedure names must be in CAPS and must not contain spaces.
From this limited editor you can create and/or modify your O4W stored procedures. One advantage to using this editor is that compilations will take effect without having to stop and re-start the OEngineServer.
Register
From the O4W Procedures Menu choose Register.
All O4W Stored Procedures must be registered in order to execute. This is a security precaution built into O4W to prevent non registered stored procedures from being executed. Select an existing stored procedure from the drop down listbox or enter the name of an O4W stored procedure that has not been registered and hit the Next button to continue. Once an O4W stored procedure has been registered it need not be registered again. To delete a registered procedure, you can use the Copy/Delete menu item.
We will now explore each component of the Definition tab:
· Description – Enter the description of this O4W stored procedure in the textbox provided.
· HTML ‘template’ - All the O4W wizard routines (O4W Forms, O4W Reports, O4W Dashboards, etc.), as well as the O4W API’s, allow the developer to specify one of more “templates” on which their output can be displayed. A template contains all the additional html elements needed to generate the full web page that a browser can display. This includes images, colors, and style elements that both surround, and may be used by, the O4W routine’s output. O4W includes several sample templates . These templates are stored in the TEMPLATES directory located within OpenInsight at \Revsoft\OInsight\O4W\TEMPLATES
· Display menu on page – A drop down list is provided to select a menu to appear when running this stored procedure. If no menu is desired choose None.
· Procedure permissions – Enter your stored procedure permissions from the drop down box. You can create additional permissions in the O4W Maintenance section of O4W.
4. The Procedure Types are as follows:
· O4W Procedure – A stored procedure written according to the O4W standards, designed to handle the event-driven format of calls. An O4W Procedure will have, as its top line, some statements similar to:
SUBROUTINE O4W_TEST_PROCEDURE(CTLENTID, EVENT, REQUEST)
· CTO/AREV64 Command – A stored procedure written for the character-based environment of CTO or AREV64, or a CTO or AREV64 built-in statement (for example, LIST). Any output generated by this type of routine should be “wrapped” in HTML to display properly on the browser. For example, a CTO stored procedure such as the following:
* Display the current date and time
PRINT OCONV(DATE(), “D4/”):” “:OCONV(TIME(), “MTHS”)
(named “SHOW_DATETIME”) could be registered, and its output captured and displayed in the browser.
· Stored Procedure – An OpenInsight stored procedure. Any output generated by this type of routine should be “wrapped” in HTML to display properly in the browser. You will define the parameters passed into, and out of, the stored procedure on the following O4W screen. For example, a stored procedure such as the following:
SUBROUTINE OI_DATE_TIME(currDate, currTime, currDateTime) currDate = OCONV(DATE(), “D4/”) currTime = OCONV(TIME(), “MTHS”) currDateTime = currDate : “ “: currTime Return 0
Could be registered, and its third parameter captured and displayed in the browser.
· Function – An OpenInsight function. The return value of the function, or one of the function parameters, should be ‘wrapped’ in ‘html’ for display on the browser page. You will define the parameters passed into, and out of, the function on the following O4W screen. For example, a function such as the following:
FUNCTION OI_DATE_TIME_FUNC(currDate, currTime) currDate = OCONV(DATE(), “D4/”) currTime = OCONV(TIME(), “MTHS”) Return currDate:” “:currTime
Could be registered, and its return value captured and displayed in the browser.
We will now explore each component of the Details tab:
· Statement/Routine/Function To Invoke – For a non-O4W procedure, you must specify the name of the stored procedure, or CTO/AREV64 command, or function to invoke
· Pass parameter by – For CTO/AREV64 commands, you may specify that parameters are passed in via “data” statements (to simulate user input), or via the actual parameters of the CTO/AREV64 stored procedure. For OpenInsight stored procedures or functions, the only available option is to pass parameters via the stored procedure parameters which are defined on the following screen.
· Get Results from – For CTO/AREV64 commands, you may specify that you wish the results to be ‘captured’ from screen output. Alternatively, and for OpenInsight stored procedures and functions, you may specify that one of the stored procedure parameters contains the results. If you have specified an OpenInsight function, you may also get the results from the function return value.
· Wrap results in HTML – If selected, the results will be wrapped in HTML for proper display in the browser. The output will be displayed inside the specified template as “preformatted text”. Only select “No” if the stored procedure, function, or CTO/AREV64 statement results already contain HTML
· Response Type
If multiple parameters were found, or defined, for the OpenInsight stored procedure, function, AREV64/CTO stored procedure, or command, you can define the prompt text to display in the “collector window” that O4W will display.
By default, the response to the prompt text will be placed in a text box. Alternatively, you can provide the name of a stored procedure to generate a list of options from which the user can choose, or the name of a stored procedure to “silently” fill in the parameter value. To generate a list of options, your stored procedure must have 3 parameters. The first parameter is the prompt text, and the second and third parameters are the list of values and codes (respectively) to display and return in the list box. The values and codes are @VM-delimited. To silently fill in the parameter, your stored procedure must have 2 parameters; the first parameter is currently unused (and can be ignored), and your stored procedure should return the value you wish to include in the parameter list as the 2nd parameter.
You can also specify which parameter should contain the “return value” to display (if the results are specified to be returned in the subroutine parameter).
Press the Save button to save your changes and register your O4W Stored Procedure.
Copy/Delete
From the O4W Procedures Menu choose Copy/Delete.
Select the O4W procedure name you want to copy. Enter the name of the O4W procedure you want to create in the textbox provided and click the Copy button. To delete an existing O4W procedure, select the form name you want to delete and press the DELETE button.
Run
From the O4W Procedures Menu choose Run.
Select the name of the O4W Procedure you want to run and press the Run button.