You need to sign in to do that
Don't have an account?
U Jay
Can i convert a number / currency to TEXT without lose trailing zeroes.
Can i convert a number / currency to TEXT without lose trailing zeroes.
<apex:outputText value="{!SUBSTITUTE(TEXT(additionalCost.List_Price__c),'.',',')}" />
<apex:outputText value="{!SUBSTITUTE(TEXT(additionalCost.List_Price__c),'.',',')}" />
You can do this by using decimal methods available in apex
If you are using any Extension or controller try below code
Try below work around
Mark this as "SOLVED" if your issue is Resolved
Regards,
Bhanu Mahesh
additionalCost.List_Price__c = additionalCost.List_Price__c.toPlainString().replace('.',',');
additionalCostList(additionalCost);
Since i have to loop over the list of additional costs on the visual force page (i have to us as < list variable>.List_Price__c . Cant use currStr.
My current code : -
<apex:outputPanel rendered ="{! If(TEXT(additionalCost.List_Price__c).Split(),true,true) }">
<apex:outputText value="{!countryCurrencySymbol} {!SUBSTITUTE(TEXT(additionalCost.List_Price__c)+'0','.',',')}" rendered="{!NOT(ISNULL(additionalCost.List_Price__c))}"/>
</apex:outputPanel>
It works but if value is 12.30 shows as 12,3 where i need 12,30.
Thanks Bhanu for your interest on this question. can you help me with this need?
If it is important for you, then work around would be go for Wrapper class and display the values from wrapper class.
In wrapper class you can prepare the required string and display it.
Because TEXT(Currency field) will automatically remove the trailing zeroes.
Try to paste your code so that I can help if you need any help
Regards,
Bhanu Mahesh
<apex:outputPanel rendered="{!IF((FIND('.',TEXT(priceBreakDownListItem.List_Price__c)) != 0) && ( LEN(TEXT(priceBreakDownListItem.List_Price__c))- FIND('.',TEXT(priceBreakDownListItem.List_Price__c)) >= 2), true, false) }"> <apex:outputText value="{!countryCurrencySymbol} {!SUBSTITUTE(TEXT(priceBreakDownListItem.List_Price__c),'.',',')}" rendered="{!NOT(ISNULL(priceBreakDownListItem.List_Price__c))}"/> </apex:outputPanel>