Rich Posted December 3, 2017 Posted December 3, 2017 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!
OlgerDiekstra Posted December 3, 2017 Posted December 3, 2017 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" )
Lee Smith Posted December 3, 2017 Posted December 3, 2017 Hi TeacherED, Try Substitute ( YourTextField ; ["d"; ""]; ["M"; ""]; ["m"; ""]; ["y"; ""]; ["/"; ""]; ["."; ""]; ["-"; ""] ) HTH Lee
doughemi Posted December 3, 2017 Posted December 3, 2017 (edited) 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 December 3, 2017 by doughemi
Rich Posted December 4, 2017 Author Posted December 4, 2017 Great stuff! Thank you all for your help!
Recommended Posts
This topic is 2558 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 accountSign in
Already have an account? Sign in here.
Sign In Now