- Posts: 1
output number to absolute number
- Daniel M
- Topic Author
- Offline
- User
Less
More
2 years 7 months ago #3668
by Daniel M
output number to absolute number was created by Daniel M
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!
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!
Please Log in or Create an account to join the conversation.
- FlowHeater-Team
- Offline
- Admin
2 years 7 months ago - 2 years 7 months ago #3669
by FlowHeater-Team
Best wishes
Robert Stark
Did this answer your question? We would be grateful if you provide a brief comment as feedback. It may also help others who may have encountered a similar problem.
Replied by FlowHeater-Team on topic output number to absolute number
Hello Daniel,
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.
C# .NET Script to retrieve absolute numbers
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.
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);
}
Best wishes
Robert Stark
Did this answer your question? We would be grateful if you provide a brief comment as feedback. It may also help others who may have encountered a similar problem.
Last edit: 2 years 7 months ago by FlowHeater-Team.
Please Log in or Create an account to join the conversation.
Time to create page: 0.260 seconds