Skip to content

Commit

Permalink
0005343: Fixed mathematical transform returning a decimal when the re…
Browse files Browse the repository at this point in the history
…sult should be an integer
  • Loading branch information
evan-miller-jumpmind committed Jun 23, 2022
1 parent d59fe01 commit c4c206f
Showing 1 changed file with 6 additions and 1 deletion.
Expand Up @@ -20,6 +20,7 @@
*/
package org.jumpmind.symmetric.io.data.transform;

import java.text.DecimalFormat;
import java.util.Map;

import org.jumpmind.db.platform.IDatabasePlatform;
Expand Down Expand Up @@ -63,7 +64,11 @@ public NewAndOldValue transform(IDatabasePlatform platform,
// Truncate the decimal place if not needed so the number can be inserted into an integer column.
String result = eval.evaluate(transformExpression);
Double dblResult = Double.valueOf(result);
if (dblResult == Math.floor(dblResult)) {
if (result.contains("E")) {
DecimalFormat format = new DecimalFormat("#");
format.setMaximumFractionDigits(340);
result = format.format(dblResult);
} else if (dblResult == Math.floor(dblResult)) {
result = result.substring(0, result.length() - 2);
}
return new NewAndOldValue(column, data, result);
Expand Down

0 comments on commit c4c206f

Please sign in to comment.