Sanjai Posted January 18, 2005 Posted January 18, 2005 Hi Friends, My first post in the year 2005. Wish you all a very happy and prosperous new year. Coming to my query, I have a global field and the data type for this global field is "Number". I want to show a message to the user on the click of a button if the field contacts any alphabetic character. This field should contain only numbers ranging from 0 to 9. From my investigation, I have noticed that FileMaker Pro is internally taking care of this and if we enter a value "1eg2", if I use trim(gField) it takes 12 and omits "eg". But I would like to show a message here before using trim function. Also if the user enters only alphabetic data then I would like to show a message to the user to enter only numeric data. Waiting for your help. Thanks, --Sanjai
aaa Posted January 18, 2005 Posted January 18, 2005 One of the ways is: to create calculation field which is like this: Case(midle(Your_Field,1,1)<="9" and midle(Your_Field,1,1)>="0" and midle(Your_Field,2,1)<="9" and midle(Your_Field,2,1)>="0" and midle(Your_Field,3,1)<="9" and midle(Your_Field,3,1)>="0" and midle(Your_Field,4,1)<="9" and midle(Your_Field,4,1)>="0" and midle(Your_Field,5,1)<="9" and midle(Your_Field,4,1)>="0" and midle(Your_Field,6,1)<="9" and midle(Your_Field,7,1)>="0" and midle(Your_Field,7,1)<="9" and midle(Your_Field,8,1)>="0","", "Field is wrong") Then put this field in layout near Your_Field in other color.
Sanjai Posted January 18, 2005 Author Posted January 18, 2005 Hi, Thanks for a quick reply. I will try the above calculation. I was thinking to do this check in a script where the field "Your_field" should be a global field with text datatype. In this way it would be a generic script such that if I have two validate field1, field2 and field3 for numeric data, I will do a set field("Your_field","field1 or field2 or field3") and then call the above script which will check if it contains any values other then 0 to 9. I will give it a try and also your solution. Right now I think that if I use the calculation field then the data in this field will occupy some space always however global data size would be limited. I was finding a solution to this and on this link "http://filemakeradvisor.com/doc/11978", there is an answer. Unfortunately, I don't have an access to filemaker advisor. But if you have could you please check in this link and see if the information could be useful for me. Thanks, --Sanjai
-Queue- Posted January 18, 2005 Posted January 18, 2005 Here's one way to validate number field A using text fields B and C. Make sure you're on a layout containing both A and B. Then Copy [select, A] Paste [select, B] Set Field [C, Substitute( B, 0, 1 )] Set Field [b, TextToNum("a" & C)] If [b <> C] If [isEmpty(:] Show Message ["Please enter only numeric data."] Else Show Message ["There is at least one alpha character in the field. Please remove it."] End If End If
Sanjai Posted January 24, 2005 Author Posted January 24, 2005 Thanks Queue, It works well now and is pretty generic. Could you also suggest me how shall I validate any numeric data which is valid for a find operation. For eg: In a global text field, I can allow the user to enter >20000 or <20000 or <>20000 but I don't want to allow the users to enter "20000<>" or "20>000" etc. Thanks again for your help. --Sanjai
Recommended Posts
This topic is 7235 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now