Chapter 9 Accessing objects using VBScript


Mapping objects

You can use VBScript to map objects from heterogeneous models.

You create or reuse a mapping for an object using the following method on the DataSource object and on the ClassifierMap object: CreateMapping(ByVal Object As BaseObject) As BaseObject.

Example

Given the following example where an OOM (oom1) contains a class (class_1) with two attributes (att1 and att2) and a PDM (pdm1) contains a table (table_1) with two columns (col1 and col2). To map the OOM class and attributes to the PDM table and columns, you have to do the following:

set ds = oom1.datasources.createnew

ds.AddSource pdm1

set map1 = ds.CreateMapping(class_1)

map1.AddSource table_1

set attmap1 = map1.CreateMapping(att1)

attmap1.AddSource col1

set attmap2 = map1.CreateMapping(att2)

attmap.AddSource col2

You can also get the mapping of an object using the following method on the DataSource object and on the ClassifierMap object: GetMapping(ByVal Object As BaseObject) As BaseObject.

Set mymap = ds.GetMapping (class_1)

Set mymap = map1.GetMapping (att1)

For more information on objects mapping, see "Mapping objects in an OOM" and "Mapping objects in a PDM" in the "Working with the OOM" and "Working with the PDM" chapters in the corresponding user's guides.

 


Copyright (C) 2005. Sybase Inc. All rights reserved.