Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Saturday, June 28, 2025 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Web Forums - SalesLogix Web Platform & Application Architect
Forum to discuss the use of the SalesLogix Web Platform, Client and Customer Portals, and the Application Architect (For version 7.2 and higher only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Web Platform & Application Architect | New ThreadView:  Search:  
 Author  Thread: Currency Math
Bill
Posts: 10
 
Currency MathYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 27 Apr 12 10:58 AM
fiogf49gjkf0d

I'm trying to do some math on currency values (divide one by another to get a percentage discount) in 7.5.4 web.  the error I am getting is "cannot convert from 'decimal?' to 'decimal'"  I have a feeling that this has something to do with how SLX stores/creates currency fields but can't figure out how to work around it.

[Reply][Quote]
Raul A. Chavez
Posts: 1300
Top 10 forum poster: 1300 posts
 
Re: Currency MathYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 27 Apr 12 1:23 PM
fiogf49gjkf0d

decimal? is a nullable variable


 


If you have a variable of type decimal? you need to do this:


// decimal? theDecimalQValue  -- This is the variable we are reading from


decimal myValue = theDecimalQValue.HasValue ? theDecimalQValue.Value : 0;


 


 

[Reply][Quote]
Bill
Posts: 10
 
Re: Currency MathYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 27 Apr 12 2:11 PM
fiogf49gjkf0d

Never mind guys.  I was able to convert the currency value to a decimal using System.Convert.ToDecimal(currency).


Interesting fix, but it worked.

[Reply][Quote]
Raul A. Chavez
Posts: 1300
Top 10 forum poster: 1300 posts
 
Re: Currency MathYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 27 Apr 12 3:26 PM
fiogf49gjkf0d

Just keep in mind that decimal? is a nullable object.


 


So, if you have this code:


 


decimal? SalesPotential = null;


if you then do:


decimal sp = System.Convert.ToDecimal(SalesPotential); 


you will probably end up with an exception


 


Better off testing your object:


if (SalesPotential.HasValue)


{


//do something


        decimal sp = SalesPotential.Value;   (The Value property of SalesPotential is actually defined as decimal


}


 


Here is some reference material for Nullable Object Types:


http://msdn.microsoft.com/en-us/library/1t3y8s4s(v=vs.80).aspx


 

[Reply][Quote]
RJ Samp
Posts: 973
Top 10 forum poster: 973 posts
 
Re: Currency MathYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 27 Apr 12 7:28 PM
fiogf49gjkf0d

Good stuff Raul.....we've come a long way since Float Double vbScript variables......

[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2025 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 6/28/2025 4:12:48 AM