Using the screen template created earlier, we are creating a screen containing a chart.
Select the Group Information object. Expand it, and select the group to which you wish to add the new screen entity.
Right click on the group and select
Create ->Entity.
Click on the Screen
bullet.
Click on the Next button at the bottom right of the screen.
In the Entity Name property, type SCREEN_WITH_CHART 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 SCREEN_TEMPLATE, which is the template that we created earlier.
Set the Default Mode property set to Edit View. We will only have one mode for this screen.
Leave the Body
Style, Editable Field
Style, Non-Editable Field Style,
Lov Style, and Link
Style properties set to (from parent), as these styles will be
taken from the SCREEN_TEMPLATE for this screen.
Click on the Next button at the bottom right of the screen.
In the Block Name property, enter CUST_HIST as the name of the block.
In the Block Type property, select Chart Block.
Set the Query Type property to Complex Query.
Leave the Datasource property set to (use parent).
In the Chart Type pop-list, select Bar Chart.
In the Chart Title property, enter Sales vs Cost.
Leave the Create Heading checkbox set to off.
In the Mode
Selection section, set the Edit
checkbox to on.
Click on the Next button at the bottom right of the screen.
The Setting Complex Query properties screen is displayed.
When the Query Type is Complex Query for any block, you must enter the select statement, filters, and ordering and grouping information manually, defining the columns to be selected and the table from which the columns will be selected.
In the Select
Statement property, enter
select year_month, sum(sls_cost) sls_cost, sum(sls_rev) sls_rev from
cust_hist_mo_dtl
In the Filters
property, to have only periods from 2003 displayed, enter
where year_month like '2003%'
In the Ordering
and Grouping property, enter
group by year_month
order by year_month
Click on the Next button on the bottom right of the screen to continue.
The Adding Fields screen is displayed, including the columns defined in the complex query. Select the columns that you wish to include in the chart.
For charts, to include a column in the chart, set the Key checkbox to on. Do this for all columns displayed.
For each column, in the Used
As property, you must define how the column will be used when generating
the chart.
For the YEAR_MONTH column, select Datapoint
Label. This is the column that is the key
to the chart, for which the values are measured. The
values in this column are used to label each bar.
For the SLS_COST and SLS_REV columns, select Datapoint
Value. These are the measured values
that determine the height of the bars.
Click on the Next button at the bottom right of the screen.
The Option
to Add More screen is displayed. We do not
need to add any additional blocks. 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 entity.
Since the screen will not allow data modifications and we only have one mode (Edit), we need to modify the LEFT_MENU block to only display the necessary links.
In the Explorer Tree, left click on the LEFT_MENU block and display the property sheet.
Set the On QBE,
On New, and On
List properties to false.
Expand the LEFT_MENU block in the Explorer Tree.
Hold down the Shift key and left click on the following
links to select them. Then double click on one
to display the Multi-Select property sheet.
QUERY
LIST
NEW
EXECUTE_SEARCH
SAVE
DELETE
CREATE
Set the Visible
property to false.
Left click on the SCREEN_WITH_CHART entity and display the property sheet.
In the Title
property, enter Sales vs Cost by Period.
Click on the Save button in the main toolbar to save the changes.
Right click on the SCREEN_WITH_CHART entity and select Designer Frame from the menu.
The screen is displayed in its default Edit mode. Expand
the Designer Tool so that you
can see the whole entity.
The CUST_HIST block needs to be expanded a little so
that it will display the chart properly. Left click
on the block to select it. Hold your cursor over
the bottom edge of the chart until it turns into a double-headed arrow.
Left click, hold down the mouse button, and drag
the edge down until it looks like it's big enough.
Click on the Save button in the main toolbar to save the changes.
To test the new screen entity, highlight it by selecting it, and click on the Run button in the main toolbar.
The Preparing to Run pop-up screen is displayed. Click
on the Run button.
The screen will be run in the browser.
Xephr is a registered trademark of NDS Systems, LC.
Copyright