Lỗi nhập excel cannot convert string to nvarchar năm 2024

I think this error comes when your database column length is less as compared to your inputted length.

Check your all columns length.

For more info see this

http://forums.asp.net/p/1228890/2212376.aspx[^]

Permalink

Share this answer

Posted 25-May-11 0:59am

Ashishmau

v2

Lỗi nhập excel cannot convert string to nvarchar năm 2024

Lỗi nhập excel cannot convert string to nvarchar năm 2024

Lỗi nhập excel cannot convert string to nvarchar năm 2024

Lỗi nhập excel cannot convert string to nvarchar năm 2024

Lỗi nhập excel cannot convert string to nvarchar năm 2024

Lỗi nhập excel cannot convert string to nvarchar năm 2024

Please Sign up or sign in to vote.

Solution 2

I think you'll have to do an explicit column mapping if they are not in exact sequence in both source and destination.

i encounter the same issue and this help me "

if they are not in exact sequence in both source and destination.

"

Permalink

Share this answer

Posted 1-Feb-19 23:13pm

Member 8079549

Add a Solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

the functions that are available in Outsystems outside and inside an aggregate are not the same, and those that are available in both places (such as TextToInteger()) don't have the same implementation, so might work differently when you use them inside an aggregate then when used outside an aggregate.

In case of a TextToInteger(), it gets translated into a CONVERT function in sql, and this function can't deal with non numeric data. When used outside an aggregate, it gracefully turns everything it can't handle into a 0.

So what are your options ?

  1. unfortunately, I don't think there is a function available in outsystems doing a try_convert inside an aggregate anybody know of one ?
  1. this is a bit too specific and messy to my liking, (i.e. will only work if the only char is indeed a *) but it might be good enough for your use case: in your calculated column, do something like this :

If((attribute ="*" or attribute = ""), 0, TextToDecimal(attribute))

  1. use a sql node instead, with something like

SELECT try_convert(decimal(6,2), {entity}.[attribute]) FROM {entity}

  1. convert before adding to your database

is there a function to the * and empty string. Do you sometimes need to know them. If not, you can change your attribute definition to decimal, and change your bootstrapping code to do the conversion between excel and your database value.

Hope this helps,

Dorine

Hi Rajan,

You are make sure , you have numeric data in entity "Enrollment" column.

If one of row is content text in "Enrollment" column than not able to convert text to numeric.

Please check your data once.

Hope this will help you.

Regards

Rahul Sahu

Hi Rajan,

the functions that are available in Outsystems outside and inside an aggregate are not the same, and those that are available in both places (such as TextToInteger()) don't have the same implementation, so might work differently when you use them inside an aggregate then when used outside an aggregate.

In case of a TextToInteger(), it gets translated into a CONVERT function in sql, and this function can't deal with non numeric data. When used outside an aggregate, it gracefully turns everything it can't handle into a 0.

So what are your options ?

  1. unfortunately, I don't think there is a function available in outsystems doing a try_convert inside an aggregate anybody know of one ?
  1. this is a bit too specific and messy to my liking, (i.e. will only work if the only char is indeed a *) but it might be good enough for your use case: in your calculated column, do something like this :

If((attribute ="*" or attribute = ""), 0, TextToDecimal(attribute))

  1. use a sql node instead, with something like

SELECT try_convert(decimal(6,2), {entity}.[attribute]) FROM {entity}

  1. convert before adding to your database

is there a function to the * and empty string. Do you sometimes need to know them. If not, you can change your attribute definition to decimal, and change your bootstrapping code to do the conversion between excel and your database value.

Hope this helps,

Dorine

Pranav Pandey

Hi Rajan Kumar,

Better to use something like this. If the conversion is not possible then pass the default value.

if( TextToDecimalValidate(MAContractDirectory202006.Enrollment) = true, TextToDecimal(MAContractDirectory202006.Enrollment),0.0).

I used this for one of my logic. It seems to work for me.

wrote:

Hi Rajan Kumar,

Better to use something like this. If the conversion is not possible then pass the default value.

if( TextToDecimalValidate(MAContractDirectory202006.Enrollment) = true, TextToDecimal(MAContractDirectory202006.Enrollment),0.0).

I used this for one of my logic. It seems to work for me.

Nope, tried that, TextToDecimalValidate can't be used inside an aggregate

Lỗi nhập excel cannot convert string to nvarchar năm 2024

Rajan Kumar

Thank you, Dorine. The

2 approach worked like a charm. I agree with your sentiment about it being too specific, but so far I haven't encountered any other character in that attribute, so I should be okay. I do not think OutSystems Aggregates support regular expressions; when I tried them, it didn't work.