Data Transformation from one data type to another

Hi,
I am trying to map some data to fields in the record that I want to publish. However, the data types are different at both ends (say, its Long or Integer at the source end and String at the target end) As a result, I cannot see the data map result when I test it. It displays the map result correctly only if the 2 data types are the same. I could not see any standard transformer service which will let me convert from one data type to another.
Any suggestions?

Thanks in advance

Anant

This may seem an extreme suggestion, but how about avoiding the use of Java types altogether? Have everything pass through as strings?

According to the wM doc:

“Object and Object list variables constrained with a Java classes should be linked only to other Object and Object list variables of the same Java class or of unknown type. Although Developer permits a link between constrained Objects of different Java classes, the run-time behavior is undefined.”

I assume that’s what you’re doing. If not, please correct me.

This is a bit off-topic for the post but…

There seems to be a growing number of questions and comments about this general topic. Associating an Object field with a Java class is a pretty cool thing, but I wonder if some might be taking things a bit too far. I wonder about the wisdom of defining Document structures with fields defined as Object and associated with a Java type (long, integer, boolean, etc.).

I wanna hear from the 6.0 users out there–What are the real benefits to using data types other than string? Are you using such Document definitions as intermediate representations only or to interact with an existing Broker document definition? Does using them cause more pain than benefit?

You are right Ananth, WM does not transform an object from one data type to another and even if it is mapped, the result sometimes are not expected. However in wM6.0, I do see the wM library (pub.math) folder has a number of services to do mathematical operations with int, float,long, etc. Maybe in future releases, the might introduce service to do type casting.

Answering to Rob’s question, I see benefits when we are processing a large number of documents and we want to keep track of total order value or any kind of summing up of data. It does make things easier to read these and do mathematical operations on them. I agree to you that most of the time, we are better off reading them as strings.

Hi Ananth,

 You can write java service in wm6.0.Your input is take object 

right click on object,click on constraint,set content type as
int,float…what ever you want click on ok button.Set outputs as
String type parameter.Go to Tool---->Generate code which
genarates java code.Now you can invoke valueOf from String
Calss or call parsing methods from Wraper classesDo what
ever manipulations you want.Invoke thos service in your main flow.
Hope that this will work for you.

Thanks,
SriniK

Thanks everyone for the suggestions. I was afraid that was the alternative I might have to use, either convert everything to string or write Java services. Since we are using CIDX documents and webMethods ES canonicals, there are different data types involved, including Date transformations. I guess the better option in that case would be to use custom Java service.

Thanks again

Anant