Jump to content

How to Quickly Find Carriage Returns in a Field?


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

Recommended Posts

I'd like to verify that a number of fields do not have any carriage returns (¶) in them.  I already have an auto-enter calculation that I am adding to each field to prevent this from happening in the future.


One solution is to create a secondary calc field that will return "1" if a carriage return is detected in 'FieldName':

PatternCount(FieldName; "¶") > 0

If I search for "1" in this secondary field it works great (and I can fix individually or quickly via Replace Field Contents), but changing the calculation is tedious to do for a large number of fields.


Is there instead a way I can enter Find Mode and enter something directly in the field I'm interested in fixing up?  I've tried the following, but no records are found:

  • "¶"
  • Char(13)
  • *"¶"
  • dat pilcrow
Link to comment
Share on other sites

This is not easy to enter manually*, but using a script you can do:

Enter Find Mode [  ]
Set Field [ Table::Textfield; ""¶"" ]
Perform Find [  ]


(*) You need to enter an actual carriage return in between the quotes, but in Find mode this would trigger the Perform Find action - so I believe the only way to do this manually is to paste it.

Link to comment
Share on other sites

comment, you're a genius.  Copying and pasting "¶" (where the ¶ is the invisible character, of course) does work manually, and your suggestion to use a script got me thinking…  So, here's my script:


Script Name:  Find All Records with "¶" In Current Field

If [IsEmpty(Get(ActiveFieldName))]
  # Cursor not in any field
  Show Custom Dialog [Get(ScriptName); "Please place your cursor in an active text field and try again."]
  Exit Script []
End If
# Attempt the find
Enter Find Mode []
Set Field By Name [Get(ActiveFieldTableName) & "::" & Get(ActiveFieldName); ""¶""]
Set Error Capture [On]
Perform Find []

Include this script in the menu, and now all I have to do is hit Command-6 (in my case) to immediately get what I want.  Perfect!

Link to comment
Share on other sites

A small nitpick and a caveat:




Set Field By Name [ Get(ActiveFieldTableName) & "::" & Get(ActiveFieldName); "abc" ]

does exactly the same thing as:

Set Field [ "abc" ]

Both rely on the cursor staying in the active field when you switch to Find mode.


When will this assumption fail? When the active field is a global field. In such case, the first version will throw a "This action cannot be performed because the required table is missing." error, while the second one will fail silently.

Link to comment
Share on other sites

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