Solved

Input box Filmaker Pro 11

Posted on 2011-09-05
2
390 Views
Last Modified: 2012-05-12
I have a database (see attached) it hase a one table and a main layout. The layout out has a button that lets the user enter any number. The inputted number populates the field 'Enter_Number' which is set to receive only numeric data. Is there a way that when the users inputs their answers, the script can check to see that the value entered is indeed only numbers.
InputBox.fp7
0
Comment
Question by:PachecoPrimo
2 Comments
 
LVL 12

Expert Comment

by:North2Alaska
ID: 36485736
I use a custom function, IsNumeric( value, separator ) that returns true or false.  I don't recall where I found it and I don't claim to have written it.  I just use it...


Let
(
   [
   decSep = If (separator = ""; "."; separator);

   trimmedValue = Trim (value);
   filteredValue = Filter ( trimmedValue ; "0123456789-" & decSep );
   lengthOk =    If (Length (trimmedValue) = Length (filteredValue);  True;  False);

   dotOccurence = PatternCount (filteredValue; decSep);
   dotOk = If (dotOccurence = 0 or dotOccurence = 1; True; False);

   minusIndex = Position (filteredValue; "-"; 1; 1);
   minusOk = If (minusIndex = 0 or minusIndex = 1; True; False)
   ];
   If (lengthOk and dotOk and minusOk;
      True;
   /*else*/
      False
   )
)

Open in new window

0
 
LVL 1

Accepted Solution

by:
soholm earned 500 total points
ID: 36522197
A way to check if the entered value is indeed numbers could be this:

Exact (Main::Enter_Number ; GetAsNumber( Main::Enter_Number) )

Open in new window


Unfortunately, the isValid() function will not cover here. It will return 'true' for a number field as long as the input contains some number even if the input also contains letters and other characters.

You may have perfectly good reasons for scripting this, but consider just using an input field on the layout instead. If you define the input field to "Always" validate instead of "Only during data entry" you may rely on FileMaker taking care of the testing instead, regardless the input situation. You may also want to clean up the input by using the nice filtering custom function proposed by North2Alaska.

The build-in FileMaker alert does not aestetically work well on top of a scripted custom dialogue box, which is another reason for avoiding a dialogue box if possible.

This could be done by putting an auto-enter calculation on the input-field. When entering you run above 'exact'-test, and if it fails you simply reset the field.

Finally, you can add script triggers on the input field if you need any further functionality to run at the time of input.

Hope this may help.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Conversion Steps for merging and consolidating separate Filemaker files The following is a step-by-step guide for the process of consolidating two or more FileMaker files (version 7 and later) into a single file with multiple tables. Sometimes th…
Problem: You have a hosted FileMaker database and users are tired of having to use Open Remote or Open Recent to access the database. They say, "can't you just give us something to double-click on rather than have to go through those dialogs?" An…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now