Book a Demo

Author Topic: PIM common data types  (Read 3419 times)

Joe Williams

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
PIM common data types
« on: November 11, 2010, 06:32:37 am »
I'm trying to design a platform independent model for persistence and transform that model into DDL. I'd like to use a data type in the PIM to represent a text field, but all of the existing common data types are already mapped to PSM data types. Besides that, none of the existing PIM common types seem to fit. I'd like to be able to add a new common data type (i.e. Text), but I can't seem to find a way to do that. From there I'd define a transformation for
Text -->to--> VARCHAR(50)
The example transformations in the help facility for MDA seems to imply that this is possible. It shows a String being transformed into a VARCHAR(20). String is not even in my list of common data types.
What am I missing here? :-?

skiwi

  • EA Expert
  • ****
  • Posts: 2081
  • Karma: +46/-82
    • View Profile
Orthogonality rules
Position and Team disestablished, thanks austerity.
Now itinerant.

FritzTheCat

  • EA Novice
  • *
  • Posts: 18
  • Karma: +0/-0
    • View Profile
Re: PIM common data types
« Reply #2 on: November 13, 2010, 12:53:08 am »
you are using a new transformation type or a set of transformation types or you are working on existing transformation types (DDL). In the transformation you will probably map the PIM datatype into a PSM datatype. you could use text or string or largeString as a PIM type and transform into varchar() or NVARCHAR2() in the attribute template. Use a tag on the PIM attribute (eg. size) and read the tag value in the attribute template to make a varchar() a varchar(50), varchar(200), varchar(max), clob, whatever. You could even default to varchar(50) if no size tag is given on the PIM attribute.

like->
%if attType == "String"%

%if $sizeTag == ""%
$datatype="NVARCHAR2("+"50"+")"
%else%
$datatype="NVARCHAR2("+$sizeTag+")"
%endIf%
 
%elseIf attType == "LargeString"%
  $datatype = "CLOB"

this code is in the attribute template and the name and type of the creating PSM attribute is set from the evaluated type like

name=%qt%$fullattrname%qt%
type=%qt%$datatype%qt%
%if $isNotNull == "TRUE"%
  NotNull
%endIf%

NotNull is also derived from a tag :-)

cheers
peter