2 Replies Latest reply on Aug 21, 2011 4:24 PM by LaRetta_1

# PatternCount function: calculation extracts text quote mark (")

### Title

PatternCount function: calculation extracts text quote mark (")

### Post

Is there a calculation, maybe other than "PatternCount" that will extract a quote mark from a text string?

If ( PatternCount ( <field name> ; " " " )  ≥ 1 ; Left ( <field name> ; Position ( <field name> ; " " "; 1 ; 1 ) -1 ) ; <field name> )

Gives "An operator is expected here:

If ( PatternCount ( <field name> ; " " " )  ≥ 1 ; Left ( <field name> ; Position ( <field name> ; " " "; 1 ; 1 ) -1 ) ; <field name> )

If ( PatternCount ( <field name> ; " " " )  ≥ 1 ; Left ( <field name> ; Position ( <field name> ; " " "; 1 ; 1 ) -1 ) ; <field name> )

Turning off "Smart Quotes" didn't solve it.

Using back slash ignores quote mark.

If ( PatternCount ( <field name> ; " \" " )  ≥ 1 ; Left ( <field name> ; Position ( <field name> ; " \" "; 1 ; 1 ) -1 ) ; <field name> )

• ###### 1. Re: PatternCount function: calculation extracts text quote mark (")

Hi Sonja,

"Is there a calculation, maybe other than "PatternCount" that will extract a quote mark from a text string?"

Can you provide a sample of the data and what the result should look like?

• ###### 2. Re: PatternCount function: calculation extracts text quote mark (")

If you want all text UP TO the first quote, try:

Trim ( If ( PatternCount ( field name ; "\"" )  ≥ 1 ; Left ( field name ; Position ( field name ; "\""; 1 ; 1 ) -1 ) ; field name ) )

Be careful when selecting the quote.  It automatically inserts a space and that will break your calc.  If you forget how to enter for escaped quotes, just type FOUR " in a row, no spaces and FM will convert it properly to "\"".

I included a Trim() because there may be trailing space to remove.  If this isn't what you want, please explain more.  :^)