cancel
Showing results for 
Search instead for 
Did you mean: 

Error converting DataType

Former Member
0 Kudos

Hi Friends,

I am struck in a scenario where the data from proxy should update in the MS SQL Database.

We have a field in the source which is given as String type and the same in Target side also.

But in the Database, it is mentioned as decimal (18, 3).

With the above conditions when i try to insert the data in the database, it is throwing an error. The error reads in Communication channel monitoring as " Error converting data type nvarchar to decimal ".

The requirement is that nothing should be modified in the database.

Can anyone please help us on this issue.

Thanks in advance ....

Regards,

Sherin Jose

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Thanks for the replies.

former_member200962
Active Contributor
0 Kudos

check this similar thread...though it is unsolved you can get some input from it....

unless an until you convert your source field value (xsd:string) to xsd:decimal format you will get this error...

Former Member
0 Kudos

hi,

Just use this in mapping.

source field-formatNumber(Number format:#.000 Decimal separator: .)targetfield.

Regards,

Prakasu.M

Former Member
0 Kudos

Hi,

I tried the same way, but it throwed an error showing "RuntimeException in Message-Mapping transformation".

Actually i feel that when some data in the decimal field is missing, it is throwing this error. but, im not sure abt this too.

Kindly suggest me a better option.

Former Member
0 Kudos

Hi,

If that field contains any character value or any symbol it will through the error.there is no problem if decimal field is missing.lets consider if value is 100 target field will fill 100.000.Kindly check your input and let me know.

Regards,

Prakasu.M

Edited by: prakasu on May 7, 2009 7:05 PM

Former Member
0 Kudos

Hi,

Thanks for the reply.

That is not the scenario actually. The input data actually comes in decimal only, it cannot come as a integer.

for example it comes as 35.002.

Here the thing is that i have given String in source datatype and String in target datatype. But, in database it is given as Decimal (16, 3). Is the error formed because of this mismatch. If so whats the solution.

Thanks in advance.

Former Member
0 Kudos

HI jose,

If the Decimal (16, 3) format (indicates before decimal max 16 digites after decimal max 3 digit numaric) will allow the same format value.it wont consider with the data type. If you are using the formatNumber(#.000) you are changing the format to required format. So if you are chaning the format to xsd:decimal also it may be a problem.If the input value contains 19.1234 it will allow.But data base not accept this value.Check your input data first. It should contain some symbol or character like -12.1234 or 12a3.123.

Regards,

Prakasu.M

Former Member
0 Kudos

Hi,

In target data type give type as XSD:Decimal and in details give total digits as 21 and fraction digits as 3.

That wil solve ur problem.

Thanks

Hamja

Former Member
0 Kudos

Hi Hamja,

The problem is facets will not support PI-7.0.

Regards,

Prakasu.M

Former Member
0 Kudos

I have figured out the solution for this.

I tried by giving decimal in both source and target. And it works now.

And also i gave string in source and target as decimal and i gave a default value of 0.00 in mapping. This also worked.

In my scenario, i faced the problem because when no data is passed for a decimal field which is given as string in both the sides and i have mapped the source and target with " Map with default ". Actually a blank space has to updated in the database if the type in database is varchar, since its decimal in database .. the blank space is not able to get updated there. but, this has been solved where im using 0.00 as default value when no data for decimal field comes to the database.

While creating Data Type, we have a option called "Default". What does this exactly mean. If we give 0.00 as default value for the decimal field and have it as string itself in source and target. Will this condition work.

Former Member
0 Kudos

>> If we give 0.00 as default value for the decimal field and have it as string itself in source and target.

Will this condition work

This wont work for you,the value specified in "Default" is for use of Proxy,this value is discarded at the time of message mapping,so the best option you have is to use the "mapWithDefault" standard function in message mapping itself and specify value 0.00 there

Thanx

Aamir

Former Member
0 Kudos

Change the same in XI...

Rajesh

Former Member
0 Kudos

Hi,

thanks for the reply.

So, what data type do i use in the XI .