I am using a formula field to concatonate 2 decimal values separated by a dash. However, I want the result to trim all unneccesary trailing zeros and decimal points for both values.
For example, I want values 10 and 8.5 to be "10 - 8.5". Now it shows "10.00 - 8.50".
The formula I am using is CSTR({field1}) + " - " + CSTR({field2}).
Converting to and from Text ValuesTEXT() converts a Percent, Number, Date, Date/Time, picklist, or Currency field into Text. TEXT() returns output without any formatting, commas, or currency signs. For example, TEXT(percent_value), if percent_value is set to 30%, returns 0.3.
When entering a formula, text strings must be enclosed in double straight quotes ( "This is a string." ). Column names must be enclosed in square brackets ( [Opportunity_Name] ). Returns a string by concatenating the values of the specified columns and input strings.
In Salesforce Knowledge article types, the file field type can't be converted into other data types. You can't change the data type of a custom field referenced by other items in Setup such as Visualforce pages, Apex code, processes, or flows. Changing a custom field type can require changing many records at once.
No, its not possible. Formula fields are a read-only fields that cannot be converted to any other data type. Likewise, you cannot convert any other field type into a formula field.
I believe this is what you're looking for:
Convert Decimal Numbers to Text showing only the non-zero decimals
Especially this line might be helpful:
StringVar text := Totext ( {Your.NumberField} , 6 , "" ) ;
The first parameter is the decimal to be converted, the second parameter is the number of decimal places and the third parameter is the separator for thousands/millions etc.
CSTR({number_field}, 0, '')
The second placeholder is for decimals.
The last placeholder is for thousands separator.
i wrote a simple function for this:
Function (stringVar param)
(
Local stringVar oneChar := '0';
Local numberVar strLen := Length(param);
Local numberVar index := strLen;
oneChar = param[strLen];
while index > 0 and oneChar = '0' do
(
oneChar := param[index];
index := index - 1;
);
Left(param , index + 1);
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With