Jump to content
Server Maintenance This Week. ×

Flag for "non-approved" characters


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

Recommended Posts

I'm looking for a calculation to use as a flag for any letters/characters that aren't approved for use in a spefic field; the approved characters are: dMmy/.-  ...and those characters can appear in any order and in any number...so that negates using PatternCount unless I make a multi-line case statement using PatternCount for each approved character, but that sounds klunky. I also tried using Filter as part of an equation but I couldn't get it to work.

Your help would be appreciated. Thanks!

Link to comment
Share on other sites

You can use filter, but you'll need to compare it to the original string to see if there's a difference. In the filter function, you specify all the characters you allow. You can compare the result of the filter function to see if any characters have been removed.

like so: If( string = filter( string; "dMm/.-" ); "ok"; "not ok" )

Link to comment
Share on other sites

TeacherEd, try

Let(
~finder = Substitute (   YourTextField ;   ["d"; "§"];   ["M"; "§"];   ["m"; "§"];   ["y"; "§"];   ["/"; "§"];   ["."; "§"];   ["-"; "§"] ); 
If(length(YourTextField) > PatternCount(~finder; "§"); "Error Message"; YourTextField)
)

§ is option-5 on a Mac; you can use any character you are certain will not appear in YourTextField.

Edited by doughemi
Link to comment
Share on other sites

This topic is 2350 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.