Decimal value 0 shows as 0E-8 after commit

0
Hi, I have a object which has many decimal fields. This objects has Audit Trail as generailized entity. When user fills value 0 it is shown as 0E-8 in Audit log which is confusing. Please let me know how to avoid this conversion and show as 0 in logs.
asked
2 answers
3

Hi Sowmya,

In the CreateLogObject Java action which is located inside the AuditTrail/Log folder you could add a specific handling for the Decimal Type, to check on the 'E-08' and handle it the same way as 0.. Starting from line 379 you could add:

			if( value instanceof Date )
				return parseDate( (Date)value, context );
				
			else if( value instanceof String)
				return parseString( (String)value );
			// 20160825 - Ivo Sturm: added for proper Decimal handling. 
			// In database it is stored with 8 trailing zeros after the comma, in cache it doesn't have, 
			// which incorrectly was creating LogLines...
			else if (value instanceof BigDecimal){
				_logNode.trace("BigDecimal member: " + member.getName() + ", value: " + value);
				String s = String.valueOf(value);
				s = s.indexOf(".") < 0 ? s : s.replaceAll("0*$", "").replaceAll("\\.$", "");
				_logNode.trace("BigDecimal member deleted trailing zeros to: " + member.getName() + ", value: " + s);
				return s;
			}

Hope this helps?

 

I do agree that this should actually be solved by Mendix, so a ticket would also be my advise.

answered
0

I would file a support request with Mendix about this issue. At the one hand I can understand why this is happening, but the audit trail module should handle this in a more elegant way in my opinion.

Regards,

Ronald

 

answered