Using the report template created earlier, we will create a report listing open sales orders by customer.
Select the Group Information object. Expand it, and select the group to which you wish to add the new report entity.
Right click on the group and select
Create->Entity.
Click on the Report
bullet.
Click on the Next button at the bottom right of the screen.
In the Entity Name property, type OPEN_SALES_ORDERS as the entity name.
Leave the Datasource
property set to (use default), since there is only one datasource for
the Xephr
In the Based On property, select REPORT_TEMPLATE, which is the template that we created earlier.
Leave the Default Mode property set to Parameter Form.
Leave the Body Style pop-list set to (from parent).
Leave the Editable Field Style pop-list set to (from parent).
Leave the Non-Editable Field Style pop-list set to (from parent).
Leave the Lov Style pop-list set to (from parent).
Leave the Link Style pop-list set to (from parent).
Leave the Document
Security set to Not Secure.
Click on the Next button at the bottom right of the screen.
In the Block Name property, enter SALES_ORDERS as the name of the block.
In the Block Type property, select Standard Block.
Set the Query Type property to Simple Query.
Leave the Datasource property set to (use parent), since there is only one datasource for the Xephr install.
In the Table property, select the name of the table or view from which the data will be obtained. Since our datasource is set to use the Oracle 9i database for NDS Applications, we will select the view OEHEAD_UVW.
Leave the Create Heading checkbox set to off since we do not want a heading to be created for the block.
In the Scheme
Selection section, set the List
bullet to on since we will be
seeing multiple records on the block at the same time.
Click on the Next button at the bottom right of the screen.
The Adding Fields screen is displayed. Select the columns that you wish to include in the report.
Click on the name of the column
to select both the Field and Label checkboxes for that column. Do
this for the following columns
CUST_NAME
CUST_NO
ESTSHIP_DT
ORDER_DATE
ORDER_NO
ORDER_SUFFIX
ORG_UNIT_ID
A key must be selected to continue. Set the Key checkbox to on for the ORDER_NO, ORDER_SUFFIX, and ORG_UNIT_ID fields as they are the keys to this view.
In the Filters
property, you could enter code to restrict the data returned from the
table. We want to include all sales orders for
the selected customer for the user's current enterprise, so enter the
following filters.
where order_status = 'O' and org_unit_id = $$ORG_UNIT_ID$$
In the Ordering and
Grouping property, you can enter code to determine the order in
which the data is displayed in the report. We want
the report to be ordered by customer number, and then sales order number,
so the following should be entered:
order by cust_no, order_no
Click on the Next button at the bottom right of the screen.
The Ordering Fields
screen is displayed next. The columns are initially
ordered as they were listed on the previous screen. To
move a field up or down, highlight the desired field by selecting it,
and click on the Move Up or Move Down buttons on the right of the screen.
Move the fields until they are in the following
order:
CUST_NO
CUST_NAME
ORDER_NO
ORDER_SUFFIX
ESTSHIP_DT
ORDER_DATE
ORG_UNIT_ID
Click on the Next button when you have finished moving the fields.
The Option to Add More screen is displayed. We need to add one more block for the parameter form for this report.
Set the Add Block or Labels flag to on.
The report is displayed. Click on the OPEN_SALES_ORDERS report to select it.
Click on the Add Block
button at the bottom of the screen to add the next block.
The Adding New Block screen is displayed.
In the Block Name field, enter PARAMETER_FORM.
Set the Block Type to Parameter Form.
Set the Create Heading flag to on as we want an extra field on this block for a header.
In the Editable Field Style pop-list, select DEFAULT_DATA_ENTRY.
In the Non-Editable Field Style pop-list, select DEFAULT_STYLE.
In the Body Style pop-list, select DEFAULT_STYLE.
In the Link Style
pop-list, select LINKS.
Click on the Next button to continue.
The Adding Fields screen is displayed next. A field is displayed here for each of the database fields that were selected on the database block.
Set the Include
flag to on for the SALES_ORDERS.CUST_NO
field, as we want the report to be able to be restricted to a specific
customer.
Click on the Next button at the bottom of the screen to continue.
The Ordering Fields
screen is displayed Next. Since we only have one
field, there's nothing to order.
Click on the Next button at the bottom of the screen to continue.
The Option to Add More
screen is displayed.
We have no more blocks to add, so click on the Finish button.
The new entity is added to the initially selected group.
Click on the Save button in the main toolbar to save the new report entity.
In the Explorer Tree, left click on the OPEN_SALES_ORDERS report entity and display the property sheet.
In the Title
property, enter the title for this report - Open Sales Orders by Customer
All other settings come from the report template.
Expand the HEADER_BLOCK block next, select the HEADER_TEXT field, and display the property sheet.
In the Contents
property, enter the name of the new report - Open Sales Orders by Customer.
Expand the PARAMETER_FORM block next.
In the List of Values property, select the CUST_NO list of values that was created in the List of Values Examples section.
In the Text Case
property, select Uppercase as customer numbers are restricted to uppercase.
In the Contents field, the global $$CUST_NO$$ is entered automatically. This global is set on the execution of the report, and if the global exists, its value will be placed in this field the next time the report is run in the same session.
Scroll down on the property sheet and in the Target
Column, the block and field that will be restricted by the value
entered in this field on the parameter form is displayed. This
is the block and field that was selected during the block creation.
Select the HEADING field and display the property sheet.
In the Contents
field, enter Open Sales Orders by Customer.
Click on the Save button in the main toolbar to save the changes.
Right click on the PARAMETER_FORM block, and select
Create > Label from the menu.
We need to add a button that will run the report.
The Adding Labels screen is displayed.
Click on the Add button to add a field to the Fields section.
In the field,
enter RUN.
Click on the Add Fields button at the bottom of the screen to add the field.
In the Explorer Tree, select the new RUN field and display the property sheet.
Set the Display As property to Button.
Set the Field Style property to DEFAULT_BUTTON.
In the Contents
property, enter Run Report.
Scroll down until you reach the On Mouse Click field.
Enter ExecuteReport();
Click on the Save button in the main toolbar to save the new field.
Right click on the PARAMETER_FORM block and select Designer Frame from the menu. We need to lay out the fields on the parameter form.
Initially, the parameter form looks something like this:
The block needs to be made taller, the header and fields need to be moved to the middle of the block, and the button needs to be moved to below the fields.
To expand the header field, click on the field that
reads Open Sales Orders by C.... Hold your cursor
over the right edge until it turns into a double-headed arrow. Then,
hold down the left mouse button and drag the edge out until you can see
all the text.
To expand the block, click on the block to select it.
Hold your cursor over the bottom edge until it
turns into a double headed arrow. Then, hold down
the left mouse button and drag down the edge until you have enough room
to move the Run button.
Move the fields around until they look like this. You
can hold down the shift key to select multiple fields at the same time.
When fields are selected, you can use the arrow
keys on the keyboard for more precise, one pixel movement.
Click on the Save button in the main toolbar to save the changes.
To test the new report entity, highlight it by selecting it in the Explorer Tree, and click on the Run button in the main toolbar.
Since a global variable was defined in the Filtering
property, you must define the value before the screen is run. Enter
100 in the value field and press
the Run button.
The parameter screen will be run in the browser.
Enter the customer number in the Cust
No field and press the Run Report
button.
The report will be generated and displayed on the screen.
Additional modifications can be made in the Designer
Tool for layout and text changes using the learned functionality,
such as expanding the size of the header and date fields, modifying the
column labels, and assigning formats mask to the order date and estimated
ship date fields.
Xephr is a registered trademark of NDS Systems, LC.
Copyright