Microsoft
Software
Hardware
Network
Question : I need to know if I have a fraction.
I'm running Notes Designer V7.0.3. Our tellers must balance their drawers each day. I have created a database that collects this information. When they enter the coin count I would like to alert them when they have entered an invalid number for a particular coin. For example if you enter 1.20 for Nickels, you're fine; if you enter 1.21 for Nickels you're not. I know that if I divide the entered number by the integer of that number there should be no fraction.
Here is my code:
r1:=@ThisValue;
n:=@RightBack(@ThisName;"_
");
v:=@If(n="Dollars";100;@If
(n="Halves
";50;@If(n
="Quarters
";25;@If(n
="Dimes";1
0;@If(n="N
ickels";5;
r1)))));
@If(r1="";@Return(r1);@Suc
cess);
a1:=(r1*100)/v;
o2:=@Integer(a1);
o1:=a1-o2;
@If(o1=0;r1;@Prompt([Ok];n
+" Error";"Incorrect value for "+n));
r1
------------
When I enter certain values, such as 1.20, I get my error message indication the entry is invalid when in fact it is.
The variables contain the following values (as they are presented in a @Prompt.
r1=1.20
n=Nickels
v=.05
a1=24
02=23
01=0.999999999999996
I assume this is because of some setting on the server.
What do I need to do to solve my problem?
Is there an @Command or a set of Script instructions?
Thansk in advance,
Richard
Answer : I need to know if I have a fraction.
Probably because you're truncating a1 with the call to @Integer.
Try using @Modulo to get the remainder instead of doing your own math.
@If(@Modulo(r1*100; v) != 0; @Prompt([OK]; n+" Error";"Incorrect value for "+n); "");
Random Solutions
SQL Grammer exception for Hibernate query
xirr in coldfusion
why i am getting this error message when trying to translate my webpage using google transalet ?
Access Reports - standard printout size
Joining Tables from Separate DB Connections in an SQL Query
Exchange 2007 Mailforward to external Address
companyweb site not found
How to point client computers away from WSUS server and back to Windows Update site?
SQL Query [Multitables] in DataGridView
Pattern mathcing and printing in file