Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Input box Filmaker Pro 11

Posted on 2011-09-05
2
Medium Priority
?
427 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 2000 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
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…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

722 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