Jump to content
Salesforce and other SMB Solutions are coming soon. ×

Recommended Posts

SHORT: When copying and pasting text from a pdf into a field and then parsing the text with a script - substitute(); If[text = "text"...]; etc - does not work with some of the lines of text.


If I delete and retype the offending text, the script works as it should.


Copying and pasting the text into Word or Notepad before pasting into FileMaker does not work either...


LONGER: I am copying and pasting several hundred pages of data from a pdf into a field in FileMaker and then parsing the data from there. Most of the parsing works as expected, but there are a few items that I can't figure out. One of the main breaking points is using the page number to indicate a new record.So for instance I have a line in my script that evaluates the line of data like so....


If [ PatternCount ( $LineData ; "Page 1" ) = 1 ] ....


As it stands, the script doesn't work. If however I delete "Page 1" and retype "Page 1" it works. I've made sure there are no blank spaces before or after the text that I'm accidentally deleting...


I'm at a loss and appreciate any thoughts.

Link to comment
Share on other sites

Update: So I tried a script that uses Substitute ( Text ; "Page 1" ; "Page 1 ) to replace the text. I typed out "Page 1" into the searchString and it didn't work. I then went back and copied and pasted "Page 1" from the raw text into searchString and sure enough it worked. So..... the characters aren't being recognized by the script. Any thoughts on how to remedy this?

Link to comment
Share on other sites

There appear to be one or more non-printing characters in the page number in the pdf. I'm not familiar with Windows text editors, but most have an ability to show invisibles. Use that feature to determine where the non-printing character resides in the "Page 1" text.


If that is the case, use WinHex or another hex editor to determine what the character is, and use the Code()function within your Substitute() function to get rid of it. (note that you will have to convert the hexadecimal character discovered in WinHex to decimal for the Code() function.


You may also be able to copy the character from the show invisibles feature and paste it into a variable and use that in your Substitute() function. For example Substitute("Page " & $$hidden & "1", "Page 1")

Edited by doughemi
Mixed up Char() and Code() (again. Sigh!)
Link to comment
Share on other sites

Here's a little script you might use to find the non-printing character(s)

Set Variable [$len; Value:Length(YourTable::input)]
Set Variable [$i; Value:1]
Set Field [YourTable::result[]; ""]
Set Variable [$theChar; Value:Middle ( YourTable::input ; $i ; 1 )]
Set Field [YourTable::result[]; YourTable::result & Code($theChar) & "-->" & $theChar & ¶]
Set Variable [$i; Value:$i + 1]
Exit Loop If [$i > $len]
End Loop

open a new file and create input and result fields, and enter the script. Paste the troublesome text in the input field and run the script. The result is a list of each character and its code. You will be able to see the invisible characters (the code for a space is 32; the invisibles will likely be less than that).

Link to comment
Share on other sites



The spaces were non-breaking spaces. The following did the trick:


Substitute ( text ; Char (160) ; " " )


Thanks for your help!

Link to comment
Share on other sites

This thread is quite old. Please start a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

Terms of Use