I have a text field that holds price values like 1190.00 and 1216.666666667.
I've used AMPscript to round the numbers to 0 decimal places. Referencing this Q&A Round a number with AMPscript I'm able to successfully change 1190.00 to 1.190. But, when testing it with the 1216.6666667 value I get an error saying:
An error occurred when attempting to evaluate a FormatNumber function call. The specified D format cannot be applied to decimal values (1216.66666666667). It is only valid for integer types. The first parameter value for a FormatNumber call must be a numeric type supported by the requested format. Value: 1216.66666666667 Format: D0
Unfortunately, I'm not able to change the field type to number, which I presume would make the AMPscript work fine.
Here's the AMPscript I've used:
%%[SET @aptprice1 = AttributeValue("Request__c:First_Apartment_Alternative__r:Price__c") IF EMPTY(@aptprice1) THEN SET @apt_price_1 = "0.00" ELSE SET @apt_price_1 = multiply(@aptprice1,1) ENDIF]%%Output:%%=FormatNumber(v(@apt_price_1),"N0","de-DE")=%%
Does anyone have any suggestions on how to fix the multi-decimal issue?
Thanks in advance.