Hello,
I'm needing to output numbers as absolute values. Is this only possible via .Net heater?
If so, please provide example in .net to assist me.
Thanks!
You could format your number with the help of the
String Format Heater
as “normal” Decimal number and afterwards just replace the “-“ sign with an empty string using the
String Replace Heater
. On the other hand you could use the below listed C# Script for the
.NET Script Heater
to get the absolute number.
Please find attached a brief example.
This attachment is hidden for guests. Please log in or register to see it.
C# .NET Script to retrieve absolute numbers
Code:
public object DoWork()
{
if (InValues.Length != 1)
throw new Exception("1 input parameter expected!");
decimal d = (decimal)InValues[0].GetDecimal();
return Math.Abs(d);
}