2 Replies Latest reply on Mar 20, 2013 3:21 PM by jwlaub

    Test for numeric on imported data



      Test for numeric on imported data


           When importing data I want to test whether a given field is enterly numeric or whether it contains any non-numeric characters.  If the data is numeric, I want to simply allow its entry, and if it is not numeric I just want to set the receiving field to zero.  This seems very easy in other applications but I am having trouble with doing this in FMP 12.  I do not want any dialog or other interuptions in the import process.


        • 1. Re: Test for numeric on imported data

               In FileMaker Context, "Importing" implies that you are using Import Records to import multiple rows of data into a table in your file. Is this what you are doing?

               If so, you can define the following auto-enter calculation on the field:

               If ( GetAsText ( Self ) = GetAsNumber ( Self ) ; self ; 0 )

               Be sure to clear the "do not replace existing values..." check box.

               You can then enable auto-enter options during your import and those rows of data where this field receives non-numeric data will be set to zero.

               If you don't want to or can't enable auto-enter options, you can use a very similar calculation with Replace Field Contents to update the values in this field immediately after importing the data. To do this with Replace Field Contents, you'd replace 'self' with the name of the field.

          • 2. Re: Test for numeric on imported data

                 Thanks very much.  That is exactly what I needed.