Jump to content
Server Maintenance This Week. ×

Finding whatever the Trim function does not find


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

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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