Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
TDIALLO
Contributor
Contributor

Data truncation: Incorrect decimal value: '' for column `syncto`.`produit_detail`.`lattitude` at row 1

Bonjour,

je rencontre un petit problème de conversion de données:

en fait en base MySQL, j'ai un champ "lattitude" type en decimal(15,12) et dans le job le champ est en String.

dans les données j'ai des valeur vide. pour éviter le problème du vide je test s'il est null ou vide ("") de me mettre null sinon la bonne valeur

LattitudeLongitude.lattitude != null ||

LattitudeLongitude.lattitude != ""

? LattitudeLongitude.lattitude : null . Malgrés cela il me ramène l'erreur suivanteData truncation: Incorrect decimal value: '' for column `syncto`.`produit_detail`.`lattitude` at row 1.

J'ai essayé aussi de transformer le String en BigDecimal avec ceci

Relational.ISNULL(LattitudeLongitude.lattitude) ||LattitudeLongitude.lattitude=="" ? new BigDecimal(0) : new BigDecimal(LattitudeLongitude.lattitude).setScale(12,BigDecimal.ROUND_FLOOR) 

j'ai même essayé avec du TRIM()

et là j'ai du

java.lang.NumberFormatException

Voici un exemple des données en entrée

***********************Anglais*********************************

Hello,

I have a small data conversion problem:

in fact in MySQL database, I have a "lattitude" type field in decimal(15,12) and in the job the field is in String.

in the data I have empty values. to avoid the problem of the void I test if it is null or empty ("") to put me null otherwise the good value

LattitudeLongitude.lattitude != null || LattitudeLongitude.lattitude != "" ? LattitudeLongitude.lattitude : null . However, it gives me the following error

Data truncation: Incorrect decimal value: '' for column `syncto`.`product_detail`.`lattitude` at row 1.

I also tried to transform the String into BigDecimal with this

Relational.ISNULL(LattitudeLongitude.lattitude) ||LattitudeLongitude.lattitude=="" ? new BigDecimal(0): new BigDecimal(LattitudeLongitude.lattitude).setScale(12,BigDecimal.ROUND_FLOOR)

I even tried with TRIM()

and there I had to

java.lang.NumberFormatException

Here is an example of the input data

Merci par avance de votre aide

Labels (3)
1 Solution

Accepted Solutions
Anonymous
Not applicable

Try this instead....

 

Relational.ISNULL(LattitudeLongitude.lattitude) ||LattitudeLongitude.lattitude.trim().equals("") ? new BigDecimal(0): new BigDecimal(LattitudeLongitude.lattitude).setScale(12,BigDecimal.ROUND_FLOOR)

 

Your issue here is because you were using "==". This checks to see whether the objects on both sides come from the same memory location. It does not check the value of objects.

View solution in original post

2 Replies
Anonymous
Not applicable

Try this instead....

 

Relational.ISNULL(LattitudeLongitude.lattitude) ||LattitudeLongitude.lattitude.trim().equals("") ? new BigDecimal(0): new BigDecimal(LattitudeLongitude.lattitude).setScale(12,BigDecimal.ROUND_FLOOR)

 

Your issue here is because you were using "==". This checks to see whether the objects on both sides come from the same memory location. It does not check the value of objects.

TDIALLO
Contributor
Contributor
Author

that works

thank you very much @rhall