This is a migrated thread and some comments may be shown as answers.

Format numbers in textbox?

1 Answer 1367 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Eldar
Top achievements
Rank 1
Eldar asked on 07 Dec 2020, 01:35 PM
I have a textbox with the following content: 
=Sum(LossOfDaysMen)/(Sum(LossOfDaysNotSet)+Sum(LossOfDaysMen)+Sum(LossOfDaysWomen))*100 + "%"

This is giving me numbers with way too many decimals, like '66.44295155..', i want to to have just 1 decimal. How can i do this within the textbox? I tried String.Format, but that does not work. Setting the format property on the entire textbox does not work either, due the '+ "%" at the end. 

I assume there's some function i can run but im unsure about what syntax works within the textbox.

Any ideas how to solve this?

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 10 Dec 2020, 10:45 AM

Hi Eldar,

When you open the Edit Expression dialog to set the value of the TextBox, you should be able to see a Functions field from the fields on the left corner.

Expand that field, then navigate to the Math section, this should let you see only the Math functions that can be used with the textbox.

From there you can use the second variant of the Round function that lets you round the value(first argument) to the specified number of fractional digits(second argument).

I hope that I have been able to help, please let me know if you have any other questions.

Regards, Dimitar Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Reem
Top achievements
Rank 1
commented on 26 Sep 2021, 02:56 PM

in my case these are the values I got from the database using query but I cannot add round because it's parameter values so I want to use edit expression to  be like this = Round( (Fields. [Offshore-HP ]),2) but it doesn't work for me I got this error 

 

 

Dimitar
Telerik team
commented on 29 Sep 2021, 09:57 AM

Thank you for the provided screenshots.

The error message is indicating the Offshore-HP field may not actually be of a numeric type. The Round(number, digits) math function expects number values for both arguments. If the field is of type string, you may try to convert it to int or double with our Conversion Functions.

If you need further assistance, please attach the report alongside some sample data, preferably in CSV or JSON format, and I will investigate the problem locally.

Tags
General Discussions
Asked by
Eldar
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or