Hello,
I have some 32-bit integers which will be be running into the millions and floating point numbers that will be in the tens of thousands. I would like to display them on a iX T12B or T12C HMI, with commas between the groups of thousands. How can I do this?
Best Regards,
Matt
Commas between thousands
-
- Posts: 824
- Joined: Tue Mar 13, 2012 9:53 am
Re: Commas between thousands
The only way to do that would be to write a script that converts your number into a string, and then you would need to insert the ',' yourself.
Below is example code that will take the OrgNumber, a double, and using C# formating it will convert it into a string that has ',' in it. It is triggered whenever the OrgNumber tag value changes. You place it in the tags tab scripting section, found in the lower left hand corner of the tags tab.
Below is example code that will take the OrgNumber, a double, and using C# formating it will convert it into a string that has ',' in it. It is triggered whenever the OrgNumber tag value changes. You place it in the tags tab scripting section, found in the lower left hand corner of the tags tab.
Code: Select all
void OrgNumber_ValueChange(System.Object sender, Neo.ApplicationFramework.Interfaces.Events.ValueChangedEventArgs e)
{
double rawNumber = Globals.Tags.OrgNumber.Value;
Globals.Tags.StringNumber.Value = rawNumber.ToString("N");
}
}
Best Regards,
Mark Monroe
Beijer Electronics, Inc. | Applications Engineer
Mark Monroe
Beijer Electronics, Inc. | Applications Engineer
-
- Posts: 15
- Joined: Tue Oct 30, 2012 8:33 pm
Re: Commas between thousands
Hello Mark,
Thank you for the prompt reply and sample code. It works perfectly.
Best Regards,
Matt
Thank you for the prompt reply and sample code. It works perfectly.
Best Regards,
Matt