The following examples include a spreadsheet template and a spreadsheet entity created from that template.
Although Xephr Repositories are initialized with a template for each entity type, we are going to create a new template in order to familiarize you with the process.
Since we want all spreadsheet files created to display the database from which they were created displayed in the file, we will create a template and add a single block with a heading on it.
Select the Template Information object.
Right click and select Create
>Template
The Entity Creation Wizard is displayed.
Click on the Spreadsheet
bullet.
Click on the Next button at the bottom right of the screen.
In the Entity Name property, type SPREADSHEET_TEMPLATE as the entity name.
Leave the Datasource
property set to (use default), since there is only one datasource for
the Xephr
Leave the Based On property set to (NONE), since this template will not be based off of any other template.
Leave the Default Mode property set to Run Report. This property determines the default mode for the reports created from this template.
In the Body Style property, select REPORT_STYLE, which was created in the Style Example section. This property determines the default style for the spreadsheet.
In the Editable Field Style property, select REPORT_STYLE, which was created in the Style Example section. . This property determines the default style for editable fields for the spreadsheet.
In the Non-Editable Field Style property, select REPORT_STYLE, which was created in the Style Example section. This property determines the default style for non-editable fields for the spreadsheet.
In the Lov Style property, select DEFAULT_STYLE, which was modified in the Style Example section. This property determines the default style for list of values activated for the spreadsheet.
In the Link
Style property, select LINKS, which was created in the Link
Style Example section. This property determines
the default style for links on the spreadsheet.
Click on the Next button at the bottom right of the screen to continue to the block creation section of the wizard. If you were not going to add a block to the template, you could click on Finish here instead.
In the Block Name property, enter HEADER as the name of the block.
In the Block Type property, select Standard Block.
Set the Query Type property to Not From Query, since the heading text will be hard coded.
Leave the Datasource property set to (use parent).
Leave the Create Heading checkbox set to off, since we do not need an extra field created for this spreadsheet.
Click on the Next button at the bottom right of the screen to add fields.
Click on the Add button to add a field.
In the field,
enter HEADER_TEXT and press the Enter key on the keyboard.
Click on the Next
button at the bottom right of the screen.
Click on the Finish button at the bottom right of the screen.
The template is created and displayed
in green in the Explorer Tree.
Click on the Save button in the main toolbar to save the new template.
Click on the SPREADSHEET_TEMPLATE entity. Verify that these settings are acceptable. For more information on these settings, see either the Property Definitions section or the Spreadsheet Templates section.
Click on the Save button in the main toolbar to save the changes.
Now we will create a spreadsheet entity that will display the contact information for customers using the template we just created.
Select the Group Information object. Expand it, and select the group to which you wish to add the new spreadsheet entity.
Right click on the group and select
Create->Entity.
Click on the Spreadsheet
bullet.
Click on the Next button at the bottom right of the screen.
In the Entity Name property, type CUSTOMER_SS as the entity name.
Leave the Datasource property set to (use default), since there is only one datasource for the Xephr install.
In the Based On property, select SPREADSHEET_TEMPLATE, which is the template that we created earlier.
Leave the Default Mode property set to Run Report.
Leave the Body Style set to (from parent).
Leave the Editable Field Style set to (from parent).
Leave the Non- Editable Field Style set to (from parent).
Leave the Lov Style set to (from parent).
Leave the Link
Style set to (from parent).
Click on the Next button at the bottom right of the screen.
In the Block Name property, enter CUSTOMERS 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).
In the Table property, select the name of the table or view from which you are exporting the data. Since our datasource is set to use the Oracle 9i database for NDS Applications, we will select the view CUSTMAST_UVW.
Leave the Create Heading checkbox set to off as we do not need an extra label field to be added for header text.
In the Scheme
Selection section, set the List bullet to on. This
block will display multiple records, and the labels need to be displayed
in a row at the top, while each record needs to be displayed in a row
beneath that. The list scheme will lay out the
records in this fashion.
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 spreadsheet.
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
CUST_URL
FAX_PHONE
TOLL FREE
A key must be selected to continue. Set the Key checkbox to on for the CUST_NO field as it is the key to this view..
In the Filters
property, you could enter code to restrict the data returned from the
table. We want to include all active customers
for the user's current enterprise, so enter the following filters:
where org_unit_id = $$ORG_UNIT_ID$$ and status_code = 'A'
In the Ordering and
Grouping property, you can enter code to determine the order in
which the data is displayed in the spreadsheet file. We
want the customer's contact information to be displayed in alphabetical
order by customer name, so the following should be entered:
order by cust_name
Click on the Next button to continue
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
TOLL_FREE
FAX_PHONE
CUST_URL
Click on the Next button when you have finished moving the fields.
The Option to Add More
screen is displayed. We have no more blocks to
add, so click on the Finish button.
In the Explorer Tree, the new entity is added to the
initially selected group.
Click on the Save button in the main toolbar to save the new spreadsheet entity.
To test the new spreadsheet 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. Since
a global variable was defined in the Filtering property, you must define
the value before the spreadsheet is run. Enter
100 in the value field and press
the Run button.
The file will be opened in your .xls file type reader.
Xephr is a registered trademark of NDS Systems, LC.
Copyright