Samples Tutorial

     Previous  Next    Open TOC in new window    View as PDF - New Window  Get Adobe Reader - New Window
Content starts here

Creating Data Services from Flat Files

Flat files, such as spreadsheets, offer a highly adaptable means of storing and manipulating data, especially data that needs to be quickly changed. Flat files are simply treated as another data source that ALDSP can use to generate metadata and create a data service.

 


Objectives

After completing this lesson, you will be able to:

 


Overview

Flat files, such as spreadsheets, often support a text format called CSV or Comma Separated Values. Such file formats typically have a .csv extension.

 


34.1 Importing Flat File Metadata

The flat file must be in a ALDSP project, before a data service can be generated. As part of the import process, you must provide a schema name, a file name, or both.

Objectives

In this exercise, you will:

Instructions

  1. Right-click the DataServices folder and import the FlatFiles folder, which is located in <beahome>\weblogic81\samples\LiquidData\EvalGuide.
  2. Import source metadata by completing the following steps:
    1. Right-click the FlatFiles folder and select Import Source Metadata.
    2. Select Delimited Data from the Data Source Type drop-down list, then click Next.
    3. Ignore the Schema field.
    4. Click Browse, next to the Delimited Source field.
    5. Select Valuation.csv and click Select.
    6. Confirm that the Has Header checkbox is enabled.
    7. By selecting this option, you specify that the header data, which is usually located in the first row of the spreadsheet, will not be treated as data within the generated data service.

    8. Confirm that the Delimited radio button is enabled. By enabling this option, you specify that the data is separated by a specific character, rather than a fixed width such as 10 spaces.
    9. Confirm that a comma (,) is in the Delimiter field. If data is delimited, then you must specify what character is used to delimit the data. Although the default is a comma, any ASCII character is supported.
    10. Click Next. The Summary dialog box opens.
    11. Click Finish. A new data service called Valuation.ds is created in the DataServices\FlatFiles.
  3. Open the Valuation.ds file in Design View.
  4. Open Valuation.ds in Design View and confirm that there is a Valuation function. This function will retrieve all data from the flat file.
  5. Figure 34-1 Design View of the Data Service Based on a Flat File


     Design View of the Data Service Based on a Flat File

 


34.2 Testing Your Flat File Data Service

After creating the data service, you need to confirm that the service is able to return data, based on the associated delimited source file.

Objectives

In this exercise, you will:

Instructions

  1. Right-click the DataServices folder.
  2. Choose Build DataServices.
  3. Open Valuation.ds in Test View.
  4. Test the data service by completing the following steps:
    1. Select Valuation() from the Function drop-down list.
    2. Click Execute.
  5. Confirm that you can retrieve data, as displayed in Figure 34-2. Notice that the return element is introspected. That is based on the header information in the Valuation.csv file.
  6. Figure 34-2 Test Results—Flat File Data Service


     Test Results—Flat File Data Service

 


34.3 Integrating Flat File Valuation with a Logical Data Service

At this point, you are able to pull data from the flat file. However, integrating the flat file data service into a logical data service lets you retrieve multiple sources of information.

Objectives

In this exercise, you will:

Instructions

  1. Open CustomerProfile.ds under DataServices/CustomerManagement/CustomerProfile in XQuery Editor View.
  2. Select getAllCustomers() from the Function drop-down list.
  3. In the Data Services Palette, expand the FlatFiles and Valuation.ds folders.
  4. Drag and drop Valuation() into XQuery Editor View.
  5. Create a simple mapping by dragging and dropping the VALUATION_DATE and VALUATION_TIER elements (valuation node) onto the corresponding elements in the Return type.
  6. Create a join. Drag and drop the CUSTOMER_ID element (Customer node) onto the corresponding element in the Valuation node. The final layout should be similar to that shown in Figure 34-3:
  7. Figure 34-3 XQuery Editor View of Flat File Data Service Integrated with Logical Data Service


    XQuery Editor View of Flat File Data Service Integrated with Logical Data Service

  8. Open CustomerProfile.ds in Source View and confirm that the following mapping have been created:
  9. Figure 34-4 Source View of Flat File Data Service Integrated with Logical Data Service


    Source View of Flat File Data Service Integrated with Logical Data Service

 


34.4 Testing an Integrated Flat File Data Service

Testing the function lets you confirm that the data is correctly retrieved.

Objectives

In this exercise, you will:

Instructions

  1. Open CustomerProfile.ds in Test View.
  2. Select getAllCustomers() from the Function drop-down list.
  3. Click Execute.
  4. Confirm that you can retrieve valuation information.
  5. Figure 34-5 Test View of Integrated Flat File Data Service


     Test View of Integrated Flat File Data Service

  6. (Optional) Use the getCustomerProfile function, enter CUSTOMER3 in the Parameter field, and click Execute.
  7. Note: Ensure that the user has access to run the getCustomerProfile function by checking the security settings in the ALDSP Console.

 


Lesson Summary

In this lesson, you learned how to:


  Back to Top       Previous  Next