Creating the SSCA Department application  Creating events

Chapter 3: Creating a Multipage Mobile Application

Creating the SSCA Employee application

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.

StepsDefining the SSCA Employee application

  1. 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.

  2. Click the down-arrow to the right of the Add button, and select Database Element.

  3. 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.

    1. Click the JDBC URL option button.

    2. 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:

        NoteFor 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.

        NoteWhen you create an application with input parameters, you must define a default value to register as click-across event listeners.

  4. 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

  5. Click Next. The Split window displays.

  6. Click Next. The Define window displays.

  7. Use the Define window to identify record 1 as the header row. In the Define Record Layout section:

  8. In the Filter window, define a filter that excludes column (field) 1.

    Click Next.

  9. 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):

  10. Click Next. The Window Preview displays.

  11. In Element Name, enter SSCA Employee. Under Window Preview, notice the grid showing Item and Data.

    Click Next.

  12. On the Continuous Capture Page, click Finish.

  13. When you return to the Application Builder window, click Save.

  14. In the Finish window, make this change (otherwise accept the defaults).

    Content tab

  15. Click Finish to create the application.

  16. Click OK to confirm.

  17. Click Close to exit the Application Builder.

  18. 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.

  19. Approve the application:

  20. 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. Creating events

View this book as PDF