Jump to content
Macro Express Forums

Testing for a valid decimal number


damac3000

Recommended Posts

:o I was wondering if there is a way or an option or if anyone knows of a script i can use. I want to test a particular number (decimal) to make sure it is vaild. I want to make sure that the number of decimals after you enter in a number is not more than 2 decimals places... ex XXX.xx ... I want to be able to set it up so that when it is invalid i can display an error message. The error message I got but to test to make sure that there are no more than 2 decimal places I do not. Any help would be appreciated
Link to comment
Share on other sites

Try this:

Variable Set Integer %N1% from Position of Text in Variable %T1%
Variable Modify String: Copy Part of %T1% to %T2%
Variable Set Integer %N2% from Length of Variable %T2%
If Variable %N2% > 3
 Text Box Display: Error: Two many decimal digits
 Macro Stop
Else
 Text Box Display: OK
End If

<IVAR2:01:13:1:.><TMVAR2:10:02:01:N01:9999:><IVAR2:02:12:2><IFVAR2:2:02:4:3><TBOX4:T:1:CenterCenter000278000200:000:Error: Two many decimal digitsError: Two many decimal digits><MSTOP><ELSE><TBOX4:T:1:CenterCenter000278000200:000:OKOK><ENDIF>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...