Define the second drill-down application—SSCA Employee. This application displays employee information. The application uses an @OP tag to dynamically select rows from the database to replace the Emp Name parameter.
Defining the SSCA Employee application
From Mobile Web Studio, select Applications from the Build menu in the left pane, select New under Application Manager, and click the New button to launch Application Builder.
Click the down-arrow to the right of the Add button, and select Database Element.
In the Database Elements Definition window, enter JDBC connection information needed for the application to access a database and extract specific database information.
The values in the following example assume that the sample database included with Mobile Web Studio—sampledb—has been started, and that it is accessible on port 4747.
Click the JDBC URL option button.
Complete these options:
Username – enter dba
,
which is the user name used to access the database.
Password – enter SQL
,
which is the password used to access the database.
JDBC Connect URL – enter the URL used by JDBC to connect to the database:
jdbc:sybase:Tds:localhost:4747?ServiceName= sampledb
JDBC driver – enter the JDBC driver used to connect to the database, in this case:
com.sybase.jdbc2.jdbc.SybDriver
SQL Query String – enter the following SQL code to select employees from sambledb:
For your convenience, cut and paste this code from the HTML
version of this guide.
select 1 as ID, 'Employee ID' as Item, convert(varchar(255), emp_id) as Data from employee where '@OP["Emp Name"="Fran Whitney"]' = emp_fname + ' ' + emp_lname
UNION
select 2 as ID, 'Employee Name', emp_fname + ' ' + emp_lname from employee e where '@OP["Emp Name"="Fran Whitney"]' = e.emp_fname + ' ' + e.emp_lname
UNION
select 3 as ID, 'Manager Name', e2.emp_fname + ' ' + e2.emp_lname from employee e, employee e2 where e2.emp_id = e.manager_id and '@OP["Emp Name"="Fran Whitney"]' = e.emp_fname + ' ' + e.emp_lname
UNION
select 4 as ID, 'Dept Name', d.dept_name from employee e, department d where e.dept_id = d.dept_id and '@OP["Emp Name"="Fran Whitney"]' = e.emp_fname + ' ' + e.emp_lname
UNION
select 5 as ID, 'Birthdate', convert(varchar(255), birth_date) from employee e where '@OP["Emp Name"="Fran Whitney"]' = e.emp_fname + ' ' + e.emp_lname
order by 1
This includes the @OP tag, Emp Name, which sets the default value to Fran Whitney. In a later step, you will assign the default on the Parameter page to complete the process.
When you create an application with input parameters,
you must define a default value to register as click-across event listeners.
Click Preview. A three-column table showing ID, Item, and Date displays in the Preview panel.
ID |
Item |
Data |
---|---|---|
1 |
Employee ID |
102 |
2 |
Employee Name |
Fran Whitney |
3 |
Manager Name |
David Scott |
4 |
Dept Name |
R & D |
5 |
Birthdate |
Jun 05 1959 12:00AM |
Click Next. The Split window displays.
Click Next. The Define window displays.
Use the Define window to identify record 1 as the header row. In the Define Record Layout section:
Click “Records contain labels.” The “Labels are displayed in Record” option displays.
Accept the default 1
,
and click Next. The Filter window displays.
In the Filter window, define a filter that excludes column (field) 1.
In the left-most drop-down list, select “Exclude field(s).”
Make sure the second drop-down list is set to “number.”
In the text box, enter 1
to
indicate you only want to include column 1.
Click Add. In Preview, field 1 is highlighted in a contrasting color, and a new rule is added under Current Filter Rules.
Click Next.
When the parameter definition window displays, specify the @OP tag as an application parameter, and define Fran Whitney as the default value for Emp Name. Complete these options and fields (accept all other defaults):
Variable – select the Variable option to the left of Emp Name.
Display Name – accept Emp
Name.
Default Value – accept Fran Whitney.
Type – accept Text Field.
Click Next. The Window Preview displays.
In Element Name, enter SSCA Employee
.
Under Window Preview, notice the grid showing Item and Data.
Click Next.
On the Continuous Capture Page, click Finish.
When you return to the Application Builder window, click Save.
In the Finish window, make this change (otherwise accept the defaults).
Name – enter SSCA
Employee
.
Click Finish to create the application.
Click OK to confirm.
Click Close to exit the Application Builder.
When you return to the Mobile Web Studio main window, select New from the Application Builder Status menu. The SSCA Employee application displays in the detail pane.
Approve the application:
Right-click the SSCA Employee application in the detail pane, and select Approval Status | Approved.
Click OK to confirm.
Select Approved from the Application Manager Status menu. You see your newly approved SSCA Employee application in the detail pane.
Copyright © 2005. Sybase Inc. All rights reserved. |
![]() |