December 5, 200619 yr Hi, Suposse you have a field with the following code in the Calculated value > Auto-enter dialog: Let ( [ //define variables: Filtered_Text = Filter (VAT; "0123456789ABCDEFGHIJKLMNÑOPQRSTUVWXYZabcdefghijklmnñopqrstuvwxyz") ; length_Text = Length (Text); length_VAT = Length (VAT); Not_filtered_Text = ? error = If ( length_Text ≠ length_VAT ; "The content of the field would be automatically corrected. Please do not use the following characters: " & ? ; "") ]; If ( error ≠ ""; error; Filtered_Text I would like the value of Not_filtered_Text to be equal to whatever characters have not been filtered(carriage return, backslash, dash, etc.). I would like them to appear as in the source text (Text). For instance: d-453.A$9 would have the following values: Filtered_Text = d453A9 Not_Filtered_Text = -.$ Additionally, I would like a second field to show the error message in case of an error. For instance, in this case, a second field in the same layout should show: "The content of the field would be automatically corrected. Please do not use the following characters: -.$ " Thanks in advance
December 5, 200619 yr What about adding... Not_filtered_text = Filter(VAT; Filtered_Text) Also a slight refinement...you don't need the Length functions. Error =If( IsEmpty(Not_filtered_text);""; "Error message " & Not_filtered_text
December 5, 200619 yr To get the "unfiltered text" you would substitute the characters to filter, one by one, by nothing. With that many characters to filter, you could do with a recursive custom function such as this one. Not sure what Trim() has to do with this.
December 7, 200619 yr Author Not sure what Trim() has to do with this. Upss! I should have said "Filter function". Please excuse me. Thank you for the link to the funtion. It was exactly what I needed. I have added a couple of changes to have a total of 3 fields and 2 custom functions: - One to show the text as it is entered. - One to show the offending characters (using the custom function provided in the link) - One to show the corrected text (using the filtering function) Regards FilterText.zip
Create an account or sign in to comment