You need to sign in to do that
Don't have an account?
Swamy P R N
converting string to decimal for wrapper class variables
Hello folks,
In wrapper class defined one variable as Decimal, but unfortunately some times i have to show string in that variable. so for this i used
Decimal.Valueof(string.Valueof('Product is not available for sale'))
but while running class and this method i'm getting followin error i.e,
Invalid decimal: Product is not available for sale.
public List<CPQsubWrapper> shwoingPrices{get;set;}
public class CPQsubWrapper{
public string couponCode{get;set;}
public Decimal actualPrice{get;set;}
}
in method added logic like:
shwoingPrices.add(new CPQsubWrapper('abc', Decimal.Valueof(string.Valueof('Product is not available for sale'))));
So please suggest me where i need to change the particulat logic.
Thank you so much in advance!!
In wrapper class defined one variable as Decimal, but unfortunately some times i have to show string in that variable. so for this i used
Decimal.Valueof(string.Valueof('Product is not available for sale'))
but while running class and this method i'm getting followin error i.e,
Invalid decimal: Product is not available for sale.
public List<CPQsubWrapper> shwoingPrices{get;set;}
public class CPQsubWrapper{
public string couponCode{get;set;}
public Decimal actualPrice{get;set;}
}
in method added logic like:
shwoingPrices.add(new CPQsubWrapper('abc', Decimal.Valueof(string.Valueof('Product is not available for sale'))));
So please suggest me where i need to change the particulat logic.
Thank you so much in advance!!
do not try to assing a strng to a decimal value , just assing a default value such as 0 and on your page check whether value is 0 and if so then render your message else show the value . you can use the rendered attribute of visualforce page componenets to determine whether to show message or the value