Linking to a Maintain Data Procedure

How to:

You can provide update capabilities directly from your report by linking it to a Maintain Data procedure.

The link can be either a URL for the WebFOCUS Servlet or a JavaScript drilldown to the Maintain Data procedure.

If it is a URL for the WebFOCUS Servlet, it must include the IBIF_cmd command with the MNTCON RUN or MNTCON EX syntax to invoke an existing Maintain Data form procedure. The link can pass control to a Maintain form, or run a batch mode Maintain procedure that does not display a user interface.

If it is a JavaScript drilldown, it uses the parent.IbComposer_drillMntdata function.

Syntax: How to Link to a Maintain Data Procedure Using a URL

TYPE=type, [subtype, ] URL=/ibi_apps/WFServlet? IBIF_cmd='MNTCON
  {RUN|EX} procname' IBIS_passthru='on' IBIS_connect='on'
  [(parameters...)], $

where:

type
Identifies the report component that you select in the web browser to execute the link. The TYPE attribute and its value must appear at the beginning of the declaration.
subtype
Are any additional attributes, such as COLUMN, LINE, or ITEM, that are needed to identify the report component that you are formatting. See Identifying a Report Component in a WebFOCUS StyleSheet for information on identifying report components.
procname
Is the name of the Maintain Data procedure.
parameters
Values that are passed to the Maintain Data procedure. For details, see Creating Parameters.

Example: Linking to a Maintain Data Procedure

The following report allows you to update the unit price for a product directly from the report output by linking the report to the appropriate Maintain procedure.

The report request is:

TABLE FILE GGPRODS
PRINT PRODUCT_DESCRIPTION VENDOR_CODE VENDOR_NAME UNIT_PRICE 
BY PRODUCT_ID
ON TABLE SET PAGE-NUM OFF
ON TABLE SET STYLE *
TYPE=REPORT, GRID=OFF, $
TYPE=DATA, COLUMN=N1,
    URL=/ibi_apps/WFServlet?(PRODUCT_ID=N1 IBIF_cmd='MNTCON RUN GGUPD1' 
IBIS_passthru=\
     'on' IBIS_connect='on'), $
ENDSTYLE
END

The Maintain Data procedure (ggupd1) is:

MAINTAIN FILE ggprods
module import(mntuws FOCCOMP)
$$Declarations
Declare pcode/a4;
Case Top
compute timechk/a0=HHMMSS();
document.referer='/ibi_apps/WFServlet?IBIF_ex=ggprod&IBIS_connect
=on'||
'&timechk='|timechk;
compute pcode = IWC.getAppCGIValue("PRODUCT_ID");
Infer ggprods.prods01.product_id into ggstk1;
Reposition PRODUCT_ID
Stack clear ggstk1 ;
For all next ggprods.prods01.product_id into ggstk1
 where product_id eq pcode;
Winform Show Form1;
EndCase
Case Updte1
for all Update ggprods.prods01.unit_price from ggstk1(1) ;
EndCase
END

Note: This is an interactive form to display data and is created in App Studio.

The report is:

When you click a Product Code, the Maintain procedure ggupd1 is invoked, which uses the IWC.getAppCGIValue function to retrieve the correct value.

Form 1 in the Maintain Data procedure ggupd1 opens and you can update the unit price for that product:

Syntax: How to Link to a Maintain Data Procedure Using a JavaScript Drilldown

TYPE=DATA,
     DRILLMENUITEM='DrillDown 1',
          JAVASCRIPT=parent.IbComposer_drillMntdata( \
     'Request2' \
     'mntcase' \
     'stack_field' \
     rptcol \
     ),
          TARGET='_parent',
$

where:

'DrillDown 1'

Is the text that displays for the drilldown link.

'Request2'

Is the name of the Maintain Data procedure.

'mntcase'

Is the name of the Maintain case.

'stack_field'

Is the stack and stack field associated with the report column.

rptcol

Is the report column specification.

Note: Multiple stack fields and report columns can be specified to pass additional values from the report to Maintain.

In the Maintain procedure, make sure the stack retrieving the values is created and the case being performed exists.

The following is a sample drilldown from a report against the MOVIES data source to a Maintain procedure. It passes the value from the first report column (N1) to the Moviecode field in the Movstk stack in the the LoadData case of the Maintain procedure named Request2.

TYPE=DATA,
     DRILLMENUITEM='DrillDown 1',
          JAVASCRIPT=parent.IbComposer_drillMntdata( \
     'Request2' \
     'LoadData' \
     'Movstk.Moviecode' \
     N1 \
     ),
          TARGET='_parent',
$

The following is the Maintain code needed in order to pass these values from the report. The Maintain procedure is named Request2.

When the report and the Maintain form are placed on the same HTML page, clicking one of the links in the report passes the values to the Maintain form, as shown in the following image.