Round to nearest even dollar
Round to nearest even dollar
I have a field that needs to be rounded to the nearest even number. For example, if the amount is 6.75 it needs to be rounded to 6. If it's 7.25 it needs to be rounded to 8. Which function (or combination) can do that?
Thanks.
Thanks.
Round to nearest even dollar
Hello Mike,
Try to use following expression:
Thank you.
Try to use following expression:
Code: Select all
{(int)value == value ? (int)value : (int)value + 1}
Re: Round to nearest even dollar
I need to use this function. However, I am not certain how or where to pit this expression...
Re: Round to nearest even dollar
Hello.
You could use this expression in text of text component.
Thank you.
You could use this expression in text of text component.
Thank you.
Re: Round to nearest even dollar
So, if my data source is: {Parts.CutPartWidth} how would I apply such?
When I use the following:
{int(Parts.CutPartWidth) == Parts.CutPartWidth ? int(Parts.CutPartWidth) : int(Parts.CutPartWidth + 1);}
I get 'undeclared 'int'' errors. What am I missing here? Any help is GREATLY appreciated.
When I use the following:
{int(Parts.CutPartWidth) == Parts.CutPartWidth ? int(Parts.CutPartWidth) : int(Parts.CutPartWidth + 1);}
I get 'undeclared 'int'' errors. What am I missing here? Any help is GREATLY appreciated.
Re: Round to nearest even dollar
Hello,
p.s. I also correct expression in previous message.
Thank you.
Try to use following expression:jrSD wrote:So, if my data source is: {Parts.CutPartWidth} how would I apply such?
When I use the following:
{int(Parts.CutPartWidth) == Parts.CutPartWidth ? int(Parts.CutPartWidth) : int(Parts.CutPartWidth + 1);}
I get 'undeclared 'int'' errors. What am I missing here? Any help is GREATLY appreciated.
Code: Select all
{(int)Parts.CutPartWidth == Parts.CutPartWidth ? (int)Parts.CutPartWidth : (int)Parts.CutPartWidth + 1}}
Thank you.
Re: Round to nearest even dollar
Thank you for responding. I am still getting a syntax error though...using:
{(int)Parts.CutPartWidth == Parts.CutPartWidth ? (int)Parts.CutPartWidth : (int)Parts.CutPartWidth + 1}
and also:
{(int)Parts.CutPartWidth == Parts.CutPartWidth ? (int)Parts.CutPartWidth : (int)Parts.CutPartWidth + 1}
{(int)Parts.CutPartWidth == Parts.CutPartWidth ? (int)Parts.CutPartWidth : (int)Parts.CutPartWidth + 1}
and also:
{(int)Parts.CutPartWidth == Parts.CutPartWidth ? (int)Parts.CutPartWidth : (int)Parts.CutPartWidth + 1}
Re: Round to nearest even dollar
Hello,
Second expressions is correct. Can you say which error message you see? Also may be you use VB.NET as script language?
Thank you.
Second expressions is correct. Can you say which error message you see? Also may be you use VB.NET as script language?
Thank you.
Re: Round to nearest even dollar
The errors i get are as follows:
1. "The error of compilation is found in the 'text' property of the 'Text21' Component: Syntax error."
2. "The error of compilation is found in the 'text' property of the 'Text21' Component: Comma,')', or a valid expression continuation expected.
3. "The error of compilation is found in the 'text' property of the 'Text21' Component: 'int' is not declared. It may be inaccessible due to its protection level.
Thank you very much for any help that could be lent...
1. "The error of compilation is found in the 'text' property of the 'Text21' Component: Syntax error."
2. "The error of compilation is found in the 'text' property of the 'Text21' Component: Comma,')', or a valid expression continuation expected.
3. "The error of compilation is found in the 'text' property of the 'Text21' Component: 'int' is not declared. It may be inaccessible due to its protection level.
Thank you very much for any help that could be lent...
Re: Round to nearest even dollar
Hello.
You didn't specify what language you use.
Do you use VB.NET script language in the report?
Thank you.
You didn't specify what language you use.
Do you use VB.NET script language in the report?
Thank you.