# Report Writer User Interfaces

Security Interface |

The security interface for the Report Designer and Report Wizard supplied with the PxPlus Report Writer has basic but limited functionality, restricting access to report definitions and input sources. You can expand on this by writing your own front-end interface. Once you have retrieved the information you need to proceed, such as the report name, input data source and file name for the definition file, you need to invoke the Report Designer or Report Wizard and pass on this information. In the case of the designer, you will also want to disable the menu items and toolbar buttons that allow directory movement or data source changes.

To update an existing file in the designer, use the PROCESS directive to invoke the Design panel. To disable the menu items and toolbar buttons, set the %RW_Security global variable first:

Example:

> %RW_Security=1
> process "Design","*rpt/rpt.en",Directory$+ReportFile$

To invoke the Report Designer to create a new report definition, you would first have to acquire the needed information, such as ReportName$, ReportFile$ and View$. Then, create a basic report using code similar to the following:

Example:

> Create_Report_Definition:
> rpt=new("*rpt/pvxreport")
> rpt'ReportName$=ReportName$
> rpt'SetDataSource(View$,"V")
> g=rpt'AddGroup(),g'Type$="H",g'Level$="PG";
> l=g'AddLine(),l'Height=12.5
> g=rpt'AddGroup(),g'Type$="D",g'Level$="L1";
> l=g'AddLine(),l'Height=12.5
> g=rpt'AddGroup(),g'Type$="F",g'Level$="00";
> l=g'AddLine(),l'Height=12.5
> g=rpt'AddGroup(),g'Type$="F",g'Level$="PG";
> l=g'AddLine(),l'Height=12.5
> rpt'Save(Directory$+ReportFile$)
> drop object rpt
> return

Then, you can invoke the designer to update the report file using the same method as above.

To invoke the Report Wizard to create a new report definition, you would first have to acquire the needed information; i.e. ReportName$, ReportFile$ and View$. Then, you can invoke the wizard using code similar to the following:

Example:

> Invoke_Wizard: \
> option$=""
> rpt=new("*rpt/pvxreport")
> process "WIZARD","*rpt/rpt.en",str(rpt),option$,ReportName$,View$
> if option$<>"CANCEL" \
> then rpt'Save(Directory$+ReportFile$);
> ReportName$=rpt'ReportName$
> drop object rpt
> return

The wizard will use the third argument as the report title, and if an input source is included as the fourth argument, then it will be loaded as the data source and the source selection controls disabled. The above logic creates a report definition file that can then be updated in the designer using the method described earlier.

For additional details on the workings of the security interface provided with the Report Writer, the associated panels, Main and NewReport, can be found and viewed in the *rpt/rpt.en panel library. The associated programs, *rpt/rwmaint and *rpt/rwnew, may be listed and viewed as well.