AnsweredAssumed Answered

Validation of data in custom dialog to accept only one single number - script

Question asked by paolobkk on Feb 3, 2015
Latest reply on Feb 5, 2015 by paolobkk

Title

Validation of data in custom dialog to accept only one single number - script

Post

I have an input system in FMP11 that uses a dialog box with a global field to input quantities for each record. On click OK the script will add the value in the record proper field.

The users should enter just one number in that dialog box global field (e.g.: "10" or "-10").

I'm trying to create a validation script to make sure that the users don't type weird stuff except that one number.

(It happened that they typed expressions and spaces, making the system fail. e.g.: "+10-5+ 30- 15" ).

So far I got to his:

Once typed the value in the Custom dialog  GLOBALFIELD and click OK ->

If [(Lenght ( Filter ( Lower ( GLOBALFIELD ) ; "1234567890-" ) )) = ( Lenght ( GLOBALFIELD) )) ) and ( Patterncount ( GLOBALFIELD ; "-" ) ≤ 1 )]

Set Field ( RECORDFIELD ; RECORDFIELD + GLOBALFIELD)

Else

Error message and Exit Script

End If

On my tests everything looks fine but I would appreciate any comment from an external eye.

Thank you all for your help.

Have a great day.

Outcomes