You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@royale.apache.org by GitBox <gi...@apache.org> on 2020/02/11 07:34:49 UTC

[GitHub] [royale-asjs] pashminakazi opened a new issue #713: Conversion of Numbers to Decimal is not working

pashminakazi opened a new issue #713: Conversion of Numbers to Decimal is not working
URL: https://github.com/apache/royale-asjs/issues/713
 
 
   Project Details are :
   https://paste.apache.org/cpo8y
   Test case is available on VDI.
   Go to Import from Select in Menu
   Go to Product -> Unit Rates from Setups in Menu
   File : com/dbz/modules/Common/dbzUnitRateSetup.mxml
   
   In Flex :
   ![image](https://user-images.githubusercontent.com/42200979/74217932-ae52fb00-4cca-11ea-850d-264379f3ac30.png)
   In Royale
   ![image](https://user-images.githubusercontent.com/42200979/74217940-b14deb80-4cca-11ea-9ff9-1b6ffb7e02fb.png)
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [royale-asjs] pashminakazi commented on issue #713: Conversion of Numbers to Decimal is not working

Posted by GitBox <gi...@apache.org>.
pashminakazi commented on issue #713: Conversion of Numbers to Decimal is not working
URL: https://github.com/apache/royale-asjs/issues/713#issuecomment-584514608
 
 
   mx:NumberFormatter is involved in Flex/Royale

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [royale-asjs] pashminakazi edited a comment on issue #713: Conversion of Numbers to Decimal is not working

Posted by GitBox <gi...@apache.org>.
pashminakazi edited a comment on issue #713: Conversion of Numbers to Decimal is not working
URL: https://github.com/apache/royale-asjs/issues/713#issuecomment-584513483
 
 
   On Clicking Convert Button fn_TestConversion function called
   ```
   protected function fn_TestConversion(event:MouseEvent):void
   			{
   				if( txtFrom.text=="")
   				{
   					Alert.show("You have specified an invalid 'From Unit' in Test Conversion.");
   					return;
   				}
   				var responder9:Responder = new Responder(fn_roListRH,fn_HandleFault);
    			 var token9:AsyncToken =roConvert.fn_EvaluteExpression(ur_functionname.text, txtFrom.text,ur_defaultvalue.text, Number(ur_roundfactor.text) );
   			 token9.addResponder(responder9);
    			 trace(token9); 
   
   				
   			}
   			
   ```
   ```
   private function fn_roListRH(e:ResultEvent):void {
   				
   				var Value:String = e.result as String;
   				txtToUnit.text = Value;
   			}
   ```
   
   This function is calling a java function
   ```
   public static String fn_EvaluteExpression(String Expression, String Value, String DValue, int RoundTo)
   	{
   		String lsReturn = DValue;
   		try{
   
   			ScriptEngineManager mgr = new ScriptEngineManager();
   			ScriptEngine engine = mgr.getEngineByName("JavaScript");
   			Expression = Expression.replaceAll("X", Value);
   			Expression = Expression.replaceAll("x", Value);
   			String foo = Expression;
   			double ldVal = fn_RoundDecimal(Double.parseDouble((engine.eval(foo).toString())), RoundTo);
   			lsReturn = String.valueOf(ldVal);
   		}
   		catch (Exception e) {}
   		return lsReturn;
   	}
   	
   ResultHandler : ```
   private function fn_roListRH(e:ResultEvent):void {
   				
   				var Value:String = e.result as String;
   				txtToUnit.text = Value;
   			}
   ```
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [royale-asjs] pashminakazi edited a comment on issue #713: Conversion of Numbers to Decimal is not working

Posted by GitBox <gi...@apache.org>.
pashminakazi edited a comment on issue #713: Conversion of Numbers to Decimal is not working
URL: https://github.com/apache/royale-asjs/issues/713#issuecomment-586144547
 
 
   What to change in NumberFormatter Precision Function?
   
   ```
   public function set precision(value:Object):void
          {
              //precisionOverride = value;
   
              _precision = value != null ?
                           int(value) : int(value)
                          /* resourceManager.getInt(
                               "formatters", "numberFormatterPrecision") */ ;
          }
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [royale-asjs] aharui commented on issue #713: Conversion of Numbers to Decimal is not working

Posted by GitBox <gi...@apache.org>.
aharui commented on issue #713: Conversion of Numbers to Decimal is not working
URL: https://github.com/apache/royale-asjs/issues/713#issuecomment-584511093
 
 
   Which Flex/Royale components are involved?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [royale-asjs] pashminakazi commented on issue #713: Conversion of Numbers to Decimal is not working

Posted by GitBox <gi...@apache.org>.
pashminakazi commented on issue #713: Conversion of Numbers to Decimal is not working
URL: https://github.com/apache/royale-asjs/issues/713#issuecomment-584562109
 
 
   mx:NumberFormatter precision is not working correctly

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [royale-asjs] pashminakazi commented on issue #713: Conversion of Numbers to Decimal is not working

Posted by GitBox <gi...@apache.org>.
pashminakazi commented on issue #713: Conversion of Numbers to Decimal is not working
URL: https://github.com/apache/royale-asjs/issues/713#issuecomment-584513483
 
 
   On Clicking Convert Button fn_TestConversion function called
   ```
   protected function fn_TestConversion(event:MouseEvent):void
   			{
   				if( txtFrom.text=="")
   				{
   					Alert.show("You have specified an invalid 'From Unit' in Test Conversion.");
   					return;
   				}
   				var responder9:Responder = new Responder(fn_roListRH,fn_HandleFault);
    			 var token9:AsyncToken =roConvert.fn_EvaluteExpression(ur_functionname.text, txtFrom.text,ur_defaultvalue.text, Number(ur_roundfactor.text) );
   			 token9.addResponder(responder9);
    			 trace(token9); 
   
   				
   			}
   			
   ```
   This function is calling a java function
   ```
   public static String fn_EvaluteExpression(String Expression, String Value, String DValue, int RoundTo)
   	{
   		String lsReturn = DValue;
   		try{
   
   			ScriptEngineManager mgr = new ScriptEngineManager();
   			ScriptEngine engine = mgr.getEngineByName("JavaScript");
   			Expression = Expression.replaceAll("X", Value);
   			Expression = Expression.replaceAll("x", Value);
   			String foo = Expression;
   			double ldVal = fn_RoundDecimal(Double.parseDouble((engine.eval(foo).toString())), RoundTo);
   			lsReturn = String.valueOf(ldVal);
   		}
   		catch (Exception e) {}
   		return lsReturn;
   	}
   	
   ResultHandler : ```
   private function fn_roListRH(e:ResultEvent):void {
   				
   				var Value:String = e.result as String;
   				txtToUnit.text = Value;
   			}
   ```
   
   Java Function :
   
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [royale-asjs] pashminakazi edited a comment on issue #713: Conversion of Numbers to Decimal is not working

Posted by GitBox <gi...@apache.org>.
pashminakazi edited a comment on issue #713: Conversion of Numbers to Decimal is not working
URL: https://github.com/apache/royale-asjs/issues/713#issuecomment-584513483
 
 
   On Clicking Convert Button fn_TestConversion function called
   ```
   protected function fn_TestConversion(event:MouseEvent):void
   			{
   				if( txtFrom.text=="")
   				{
   					Alert.show("You have specified an invalid 'From Unit' in Test Conversion.");
   					return;
   				}
   				var responder9:Responder = new Responder(fn_roListRH,fn_HandleFault);
    			 var token9:AsyncToken =roConvert.fn_EvaluteExpression(ur_functionname.text, txtFrom.text,ur_defaultvalue.text, Number(ur_roundfactor.text) );
   			 token9.addResponder(responder9);
    			 trace(token9); 
   
   				
   			}
   			
   ```
   This function is calling a java function
   ```
   public static String fn_EvaluteExpression(String Expression, String Value, String DValue, int RoundTo)
   	{
   		String lsReturn = DValue;
   		try{
   
   			ScriptEngineManager mgr = new ScriptEngineManager();
   			ScriptEngine engine = mgr.getEngineByName("JavaScript");
   			Expression = Expression.replaceAll("X", Value);
   			Expression = Expression.replaceAll("x", Value);
   			String foo = Expression;
   			double ldVal = fn_RoundDecimal(Double.parseDouble((engine.eval(foo).toString())), RoundTo);
   			lsReturn = String.valueOf(ldVal);
   		}
   		catch (Exception e) {}
   		return lsReturn;
   	}
   	
   ResultHandler : ```
   private function fn_roListRH(e:ResultEvent):void {
   				
   				var Value:String = e.result as String;
   				txtToUnit.text = Value;
   			}
   ```
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [royale-asjs] pashminakazi commented on issue #713: Conversion of Numbers to Decimal is not working

Posted by GitBox <gi...@apache.org>.
pashminakazi commented on issue #713: Conversion of Numbers to Decimal is not working
URL: https://github.com/apache/royale-asjs/issues/713#issuecomment-584514160
 
 
   txtFrom is TextInput which is one of the parameter passing to Java function
   while passing it is sending only 3 instead of 3.000 to java function.
   <s:TextInput x="129" y="18.5" width="94" height="22" valueCommit="txtFrom_valueCommitHandler(event)" enabled="true" id="txtFrom" tabIndex="6" restrict="0-9."/>
   
   valueCommit :
   ```
   protected function txtFrom_valueCommitHandler(event:FlexEvent):void
   			{
   				txtFrom.text = fmtNumber1.format(txtFrom.text);
   			}
   ```
   <mx:NumberFormatter id="fmtNumber1" decimalSeparatorFrom="." decimalSeparatorTo="." precision="3"
   							rounding="nearest" thousandsSeparatorFrom="," thousandsSeparatorTo="," 	useNegativeSign="true"
   							useThousandsSeparator="true"/>
   		

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [royale-asjs] aharui closed issue #713: Conversion of Numbers to Decimal is not working

Posted by GitBox <gi...@apache.org>.
aharui closed issue #713: Conversion of Numbers to Decimal is not working
URL: https://github.com/apache/royale-asjs/issues/713
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [royale-asjs] pashminakazi commented on issue #713: Conversion of Numbers to Decimal is not working

Posted by GitBox <gi...@apache.org>.
pashminakazi commented on issue #713: Conversion of Numbers to Decimal is not working
URL: https://github.com/apache/royale-asjs/issues/713#issuecomment-586144547
 
 
   What to change in NumberFormatter Precision Function?
   
   public function set precision(value:Object):void
          {
              //precisionOverride = value;
   
              _precision = value != null ?
                           int(value) : int(value)
                          /* resourceManager.getInt(
                               "formatters", "numberFormatterPrecision") */ ;
          }

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services