Creating Scope Definitions

Creating a scope definition on the web is similar to defining it in the Windows client with the following exception: You cannot specify an effective date for the tree node table or value table. The current date is used as the effective date.

Select Reporting Tools > PS/nVision > PS/nVision Scope Definitions to access the Scope Definition page where you can create scope definitions.

See Understanding Report Scopes, Defining Scopes, Creating Report Requests.

This example illustrates the fields and controls on the Scope Definition page.

Scope Definition page

Scopes are defined based on a tree node record or a value table such as Department table or Product table. By defining your scope based on a table that includes an email address or user ID for each value you can direct each scope based-report instance to a different user. For example, the record shown the following table can be used with a scope definition as a value table to have each report instance sent by email or posted to a different user in Report Manager.

Department

(DEPTID)

Description

(DESCR)

Manager

Email Address

(EMAILID)

User ID

(OPRID)

12000

Sales Canada

John Smith

john_smith@abc.com

U:JOHNSMITH

13000

Sales USA

Jane White

jane_white@abc.com

U:JANEWHITE

14000

Sales Asia

Asia Manager

Kathy_Lin@abc.com; U:PeterYu;R:AsiaManager

U:KathyLin;U:PeterYU; R:AsiaManager

Scope variables are used in the Email and Security templates the same way that you use them to create unique file names with the File template or directory names with the Directory template in your report request. The Scope Descriptive Variable (%DES%) is used to select a related field value from the Scope Value table or the Tree Node table. You can use values for email addresses, user Ids, or role Ids. The general syntax of the %DES% variable is:

%DES.[scope field].[detail field].[node field]%

If your scope is based on a value table, replace [node field] with [detail field]. The [detail field] is repeated so that the basic format of the syntax remains the same.

Note: The %DES% variable requires the associated field value be in the same table that the scope is based on.

Email Template Variables

To have each report instance sent as email to the associated email address of department manager, you would enter the following values in your email template:

%DES.DEPTID.EMAILID.EMAILID%

This values enables PS/nVision to use the associated email address from the EMAILID field from the value table where the DEPTID is located. You need to specify email as the output type on the report request.

The scope descriptive variable (%DES%) is used to select a related field value from the scope value table. For example, if your scope were based on the record shown above, you would produce three report instances, and each instance would be sent to the associated email address. The report for department 12000 would be emailed to john_smith@abc.com, and the report for 13000 would be emailed to jane_white@abc.com. The report for department 14000 would be emailed to several recipients—Kathy Lin, Peter Yu, and the email addresses for the users who belong to the role Asia Manager. You can specify the user email addresses associated with users and roles in the user profiles of Maintain Security.

Security Template Variables

Using the record above for the value table, you could post each report instance to Report Manager for the associated user. In this case you would use web as the output type and enter the following variables in the security template:

%DES.DEPTID.OPRID.OPRID%

The report for department 12000 would be posted to Report Manager for user JOHNSMITH, and the report for 13000 would be posted for user JANEWHITE. John Smith would not be able to access the Department 13000 report. The report for department 14000 would be posted to Report Manager for Kathy Lin, Peter Yu, and the other users belonging to the role Asia Manager.

Sample Record Definition

This example shows the record definition used to create a view that joins the department record (DEPT_TBL) with a PeopleSoft security record (PSOPRDEFN).

Application Designer window - NVS_DEPT_VIEW record

SQL View Text

The SQL view text joins the PS_DEPT_TBL.MANAGER_ID with the PSOPRDEFN.EMPLID in security. The email address and user ID (OPRID) are taken from PSOPRDEFN.

SELECT B.DEPTID 
, B.DESCR 
, B.DESCRSHORT 
, ‘U:’ + A.OPRID 
, A.EMAILID 
, A.EMPLID 
FROM PSOPRDEFN A 
, PS_DEPT_TBL B 
WHERE B.EFFDT = ( 
SELECT MAX(B_ED.EFFDT) 
FROM PS_DEPT_TBL B_ED 
WHERE B.DEPTID = B_ED.DEPTID 
	AND B_ED.EFFDT <= SUBSTRING(CONVERT(CHAR,GETDATE(),121), 1, 10)) 
	AND A.EMPLID = B.MANAGER_ID AND B.MANAGER_ID <> ‘’

Note: This simple example uses Microsoft SQL database platform-specific syntax and should not be used without careful evaluation. You may get unpredictable results if the scope definition returns more than one row from the value table for each scope value.