FormatDecimal(CompensationAmount * 100/ 112, 2, ",", Site.GroupSeparator)


Hi kan2332,

It seems that CompensationAmount isn't a number?... maybe if you provided more context to the problem it would help.

Cheers

Hi,

From the error seems to be compensationDocument variable is not decimal type so please convert it to decimal (use data type conversation )like

if it is text

FormatDecimal(TextToDecimal(CompensationAmount) * 100/ 112, 2, ",", Site.GroupSeparator)

if it is an integer

FormatDecimal(IntegerToDecimal(CompensationAmount) * 100/ 112, 2, ",", Site.GroupSeparator)

hope it will help you

Regards,

Krushna

Hi,

CompensationAmount should be Decimal data type

Jorge Martins wrote:

Hi kan2332,

It seems that CompensationAmount isn't a number?... maybe if you provided more context to the problem it would help.

Cheers

 CompensationAmount - Variable


 

Krushana Mantri wrote:

Hi,

From the error seems to be compensationDocument variable is not decimal type so please convert it to decimal (use data type conversation )like

if it is text

FormatDecimal(TextToDecimal(CompensationAmount) * 100/ 112, 2, ",", Site.GroupSeparator)

if it is an integer

FormatDecimal(IntegerToDecimal(CompensationAmount) * 100/ 112, 2, ",", Site.GroupSeparator)

hope it will help you

Regards,

Krushna

 How to minus two values correctly

 

kan2332,

FormatDecimal outputs a Text value...

You want your CompensationAmount value to be just the GetApplicationsSum...AmountBuilderSum* GetApplicationsCommonData...PledgeBuilders.Amends / 100 portion. When you display CompensationAmount on the screen you may want to format it as a decimal, but not before. This way when you use the value later (like you are doing in your problematic expression above) then it will be a number and you will be able to do math with it

Hope this helps!

kan2332 wrote:

Krushana Mantri wrote:

Hi,

From the error seems to be compensationDocument variable is not decimal type so please convert it to decimal (use data type conversation )like

if it is text

FormatDecimal(TextToDecimal(CompensationAmount) * 100/ 112, 2, ",", Site.GroupSeparator)

if it is an integer

FormatDecimal(IntegerToDecimal(CompensationAmount) * 100/ 112, 2, ",", Site.GroupSeparator)

hope it will help you

Regards,

Krushna

 How to minus two values correctly

 

 as per my understanding of this, you want to convert decimal to subtraction of two variable

it should be like (Suppposing both variables data type is Text)

FormatDecimal((TextToDecimal(CompensationAmount)-TextToDecimal(Value)) * 100/ 112, 2, ",", Site.GroupSeparator)

 

Krushana Mantri wrote:

kan2332 wrote:

Krushana Mantri wrote:

Hi,

From the error seems to be compensationDocument variable is not decimal type so please convert it to decimal (use data type conversation )like

if it is text

FormatDecimal(TextToDecimal(CompensationAmount) * 100/ 112, 2, ",", Site.GroupSeparator)

if it is an integer

FormatDecimal(IntegerToDecimal(CompensationAmount) * 100/ 112, 2, ",", Site.GroupSeparator)

hope it will help you

Regards,

Krushna

 How to minus two values correctly

 

 as per my understanding of this, you want to convert decimal to subtraction of two variable

it should be like (Suppposing both variables data type is Text)

FormatDecimal((TextToDecimal(CompensationAmount)-TextToDecimal(Value)) * 100/ 112, 2, ",", Site.GroupSeparator)

 

addMapElementToList(Map,getMapElement("SumNds",FormatDecimal((TextToDecimal(CompensationAmount)-TextToDecimal(Value)), 2, ",", Site.GroupSeparator)))

True?

kan2332,

Please use the right data types for your variables. If a variable is going to hold a decimal value, make sure the variable's data type is set to Decimal.

Having the right data types for variables means Service Studio will help you avoid problems instead of adding extra problems like you are experiencing. It also means you can use any operations that are valid for the data type (like subtracting two decimal numbers).

Except in very specific corner cases, you should only use any of the Format functions when you are displaying data.

Hope this clarifies...

kan2332,

Jorge Martins is right, the root cause of your problem is selecting the wrong datatype. The reply from Krushana Mantri that you marked as solution is something I definitely not consider something I would want other people to follow, so I would kindly ask you to unmark that reply as a solution. Although you might think it solved your problem, it sends the wrong message to people reading your problem and seeing how it is solved. It will also generate more problems when dealing with input validation etc. 

Therefor I would ask you to consider marking Jorge Martins, last reply as the solution.

Regards,

Daniel