Solved

Input box Filmaker Pro 11

Posted on 2011-09-05
2
379 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Pop up windows can be a useful feature of any Filemaker database.  Though best used sparingly, they can be employed in a multitude of different ways, for example;  as a splash screen at login, during scripted processes to control user input, as pick…
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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

706 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

12 Experts available now in Live!

Get 1:1 Help Now