Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

This topic is 7028 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I would like to find a way to enforce a type of entry in a field.

For example, if a field is designanted for a file name with a naming convention such as IP_xxx (where xxx are number values) and I want to ensure that the user follows the convention, can there be a pop window where this requirement is prompted?

Posted

Hi merkaba22,

You can use field-level validation. FM provides its own popup context window. Some find it unfriendly. I tend to use Custom Dialog to prompt my Users whenever possible. But if you want to use Custom Dialog, you must find a way to trigger a script (either with plugin on field exit or requiring the User click a button to fire it). And asking a User to fire a button to check their own validation is like asking an IRS Agent to audit his own taxes.

Usually, a test is devised which uses PatternCount(), Length() and/or other functions to test the field. You would use Validation tab in Field Definitions or test during a script run (inside a Custom Dialog). If validation fails at field level, warning message provided is a bit unpleasant (although you can taylor it). However, if validation fails during script, you can walk a User nicely through to correcting their entry. But again ... you need a trigger - or your Users need to click button. Event plugins are a whole 'nuther' subject all themselves, ranging from complex (and more expensive) to free (but good) and some are downright dangerous.

Do you have ideas about which technique might work the best for you? I am not familiar with IP specifications. If you provide the specifc text-pattern requird, we can give you a validation calculation (to use at field- or script-level). :wink2:

There is one more method - Lord help for me for forgetting ... Auto-Enter (Replace) calculation. Whenver possible (if I remember, smile), I simply take what a User enters and fix it for them. I would try this way first if possible. In this situation, I would place an example string above the field. Auto-Enter (Replace) can determine if it's valid (or even close sometimes) and fix it, or provide the word -ERROR-. It can't enforce (if it can't fix) however so first you must decide the importance of the error trapping.

Just some thoughts ...

ps - no offense if there are any IRS Agents currently working in FileMaker. I am sure you are exceptional people. :crazy2::smile2:

LaRetta

Posted

Thank you LaRetta!

<>

I have lightly greyed text above the field and would like to have an alert if the user fails to follow the example.

Such as: if the required field is MP_xxxx and the user just puts MP_374 (without the fourth digit) or P-3745 (without the "M" of "MP prefix), then the user gets a dialog to prompt for the correction as a requirement to proceeding ....

An example of how this might appear as calculation, perhaps, would be greatly appreciated:)

Posted (edited)

I'm no text magician. I'm confident there are better ways but this appears to work:

Left ( text ; 3 ) = "MP_" and

Length (

Filter (

Middle (

text ; 4 ; 99 ) ;

"0123456789" )

) = 3 and

Length ( text) = 6

It seems a bit like overkill, but it was the only way I could think to protect from everything I could think of that a User might misenter. :wink2:

Add this calc in the 'validate by calculation' in field definition. Provide a custom message telling them to correct their entry. Above, uncheck 'Allow User Override".

LaRetta

Edited by Guest
Posted

I get a double Revert message. I dislike field validation. Can someone help me out here? I wouldn't be happy with this if I was merkaba22 (or his Users). :crazy2:

L

Posted (edited)

this:

Left ( CID_FileName ; 4 ) = "CID_" and Length (CID_FileName) and Filter (Middle (CID_FileName; 4 ; 99) and "0123456789" )) = 3 and Length (CID_FileName) = 6

gets me a prompt that "there are too few parameters here" and highlights the double parentheses marks after "0123456789"

I am not clear on how to resolve ....

And thanks again:)

Edited by Guest
Posted

this ( for the LaRetta example: 3 chars and 4 digits)) works:

Left ( CID_FileName ; 3 ) = "MP_" and

Length (

Filter (Middle (

CID_FileName; 4 ; 99) ;

"0123456789" )

) = 4 and

Length (CID_FileName) = 7

For your example ( 4 chars and 3 digits):)

Left ( CID_FileName ; 4 ) = "CID_" and Length (Filter (Middle (CID_FileName; 5 ; 99) ; "0123456789" )) = 3 and Length (CID_FileName) = 7

Posted

Hi Daniele -- thanks!

The calc formula works in that I can close out of the calc window for the field definition.

But when I try to enter into the field in the browse mode (which shows a "0", I get a message that says the field is not modifiable.

So... there must be something I am not understanding, if you will ...

thanks again:)

Posted

Thanks for the catch on my calc, Daniele. I incorrectly established the length of the trailing digits at 3 instead of 4. I had looked at the wrong sample text above. The reason you are getting 0 in the calculation is that validation is boolean, producing either 0 (fails validation) or 1 (passes validation). The numbers must total. MP_xxxx becomes CID_xxxx. CID is 4, digits are 4? Length would be 8. As Daniele explained, this calculation must be applied to your CID_FileName field under the Validation tab. I've included the calc thinking in red ...

Left ( CID_FileName ; 4 ) = "CID_" and [color:red](4 is first four characters)

Length (

Filter (Middle (

CID_FileName; 5 ; 99) ; [color:red](5 is starting position of digits. 99 is arbitrary number to be sure all remaiining field characters are included in the filter)

"0123456789" )

) = 4 and [color:red](4 is TOTAL number of digits) after filtered)

Length (CID_FileName) = 8 [color:red](4 characters plus 4 digits equals total field length)

I hope that clarifies how each of these numbers needs to be used to pass the validation test on your CID_FileName field. If you end up also receiving two validation failure alert boxes, let me know. It's not because of the calculation. I'm sure there is a way to overcome that annoying second alert ... it might just be my FM 7 version here (7.0v1). :wink2:

LaRetta

This topic is 7028 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.