Content starts here Handle Unmapped Required Values
This page last changed on Mar 11, 2008.

eDocs Home > BEA AquaLogic Data Services Platform Documentation > Data Services Developer's Guide > Contents

How To Handle Unmapped Required Values

This topic describes how to enable an update map when the data sources on the left have required elements that are not mapped from the return type on the right.

Overview

When required mappings are missing, the Create-Update-Delete procedures for the update block are disabled. That means you cannot create, update, or delete the underlying data sources. In Studio, the update map looks like this.

Required Mappings Are Missing

  • A mapping that was deleted from or did not exist in the query map.
  • An XML return type that does not contain all required elements. This can be valid, especially if you do not want to expose all elements in your data sources to a client application.

If an element is required but does not have a value, it is marked with a Warning icon .

In either case, the Create, Update, or Delete procedures do not work, so you need to resolve the error. You can do either of these:

  • Draw the mapping in Query Map view.
  • Enter an override value (either an expression or a constant) in the expression editor.

Draw the Mapping

To draw the mapping in the Query Map tab:

  1. Click Query Map.
  2. Drag from an element in a data source on the left to the matching element in a return type on the right.

Make sure the elements have the same data types or similar data types that are cast implicitly.

Cast a Constant

If you enter a constant to override the missing mapping, it is only used with Create procedures, to insert data into the data source. Update procedures ignore the override values you enter and leave the data source unchanged. (Of course, Delete procedures delete a record from the data source, so override values are not relevant to them.)

When you enter an override value, make sure the value you enter has the data type the element in the physical data source requires. You can enter a constant like "44" or "2007-01-01" and cast it to an XML Schema data type such as xs:integer or xs:date, using either of these:

The parentheses cast operator uses any XML Schema data type outside the parentheses and a string that is appropriate for the data type you are casting to within the parentheses. For example, you can perform these casts:

xs:date("2007-01-01")
xs:dateTime("2007-01-01T16:44:44")
xs:integer("44")

But you cannot perform these:

xs:date("2007-01-01T16:44:44")
xs:dateTime("date")
xs:integer("text")

To cast a constant in the expression editor:

  1. Click the Update Map tab.
  2. Click an unmapped element in a data source on the left.
  3. In the expression editor, enter a constant that has the data type the element requires. For example, for an element of type xs:string, you might enter:
    "Bob"

    If the element has another data type, enter a string within a cast expression, for example:

    xs:integer("44")
    xs:dateTime("2007-07-17T09:00:00")
  4. Continue for all disabled elements.
  5. In the Test tab, test an update using Run - Edit - Submit to make sure the value overrides work as you expect. 

See Also

Concepts
How Tos
Other Resources



Document generated by Confluence on Apr 28, 2008 15:57