<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Answers to: Number as null</title><link>https://answers.axonivy.com/questions/2669/number-as-null</link><description>&lt;p&gt;Dear Ivy Team.&lt;/p&gt;
&lt;p&gt;We faced with the autounboxing problem.
On UI side we have input field for number:&lt;br&gt;
&amp;lt;pe:inputNumber value=#{data.num}/&amp;gt;&lt;br&gt;
or &amp;lt;p:inputText value=#{data.num}&amp;gt;&lt;/p&gt;
&lt;p&gt;On data model, the field 'num' has type Number.
When a user saves data, then we get value 0 in this field.
Can we store null value?&lt;/p&gt;
&lt;p&gt;We read question:&lt;br&gt;
&lt;a href="http://answers.axonivy.com/questions/1674/auto-initialisation-number-0-from-jsf-view"&gt;http://answers.axonivy.com/questions/1674/auto-initialisation-number-0-from-jsf-view&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;We tried set COERCE_TO_ZERO=false in: 
\AxonIvyDesigner6.5.0.53277\webapps\ivy\WEB-INF\web.xml&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;context-param&amp;gt;
&amp;lt;param-name&amp;gt;org.apache.el.parser.COERCE_TO_ZERO&amp;lt;/param-name&amp;gt;
&amp;lt;param-value&amp;gt;false&amp;lt;/param-value&amp;gt;
&amp;lt;/context-param&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;in %JAVA_OPTS%: -Dorg.apache.el.parser.COERCE_TO_ZERO=false&lt;br&gt;
in process code, as: 
System.setProperty("org.apache.el.parser.COERCE_TO_ZERO", Boolean.FALSE.toString());&lt;/p&gt;
&lt;p&gt;But it didn't help for us.&lt;br&gt;
Could you correct us, what do we need do any more for Designer and then for Engine?&lt;/p&gt;
&lt;p&gt;Where do we need set variable &lt;strong&gt;ivy.vm.additional.options&lt;/strong&gt;?&lt;/p&gt;</description><atom:link href="https://answers.axonivy.com/questions/2669/number-as-null" rel="self"></atom:link><language>en</language><lastBuildDate>Fri, 09 Jun 2017 08:34:39 -0400</lastBuildDate><item><title>Answer by Reto Weiss</title><link>https://answers.axonivy.com/questions/2669/number-as-null/2694</link><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;of all you have to set the system property &lt;code&gt;org.apache.el.parser.COERCE_TO_ZERO&lt;/code&gt; to &lt;code&gt;false&lt;/code&gt; as described by you about. This can be done in the AxonIvyDesigner.ini of the AxonIvyEngine.ilc file on Windows. This turns of that JSF replaces null values through 0.&lt;/li&gt;
&lt;li&gt;IvyScript tries to auto initialize most of the values. This means that if a number is null IvyScript will turn it into a 0. Even though you can test if a 0 is set manually or was auto initialized. This can be done with the operator &lt;code&gt;is initialized&lt;/code&gt;. &lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;ivy.log.info("Was initialized manually:"+(in.num is initialized) +" Value "+in.num);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;With that you can decide if the field was empty (value is 0 but not initialized) or if the user has entered a 0 (value is 0 and initialized).&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;Reto Weiss, ivyTeam Support&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Reto Weiss</dc:creator><pubDate>Fri, 09 Jun 2017 08:34:39 -0400</pubDate><guid>https://answers.axonivy.com/questions/2669/number-as-null/2694</guid></item></channel></rss>