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
I need a document Management System need HELP?
How can I use double click function on a subform datasheet to open a new form with a specific record?
How many millimeters between the outer most screws on a standard SATA 3.5" hard drive?
CSS Sticky Bottom
which window7 machines are supporting remote desktop connection of microsoft for multi user in same time?
How to force user to place 'ksh' before running a shell script
Filer a form with comobox value
FTP question: Need to delete files based on date
populate textbox in javascript
Can changing the title of my pages affect my Google Adsense earnings?