dkey Posted December 13, 2012 Posted December 13, 2012 After importing a several hundred files from Textwrangler Latin1 encoded, they become UTF-8 in Filemaker as there is no "Latin-1" import facility as I understand it I need to extract the last word of the first line in a text paragraph This is the simple file I am dealing with and all others are similar as they hae the student name "ID: " and the number. "Jack ID: 2389526 Dear Sir Could you please give me your opnion on the short film I show in class today' Most classmate didn't like the Black and White, but I think is appropriate for the story. Can this be because Colour is what they always see? Thanks Jack" My script is as follows Middle ( MailsMessagesNew::Message ; Position ( MailsMessagesNew::Message ; "ID: " ; 1 ; 1 ) + 4; Position ( MailsMessagesNew::Message ; " " ; 1 ; 1 ) - Position ( MailsMessagesNew::Message ; "ID: " ; 1 ; 1 ) + 4 ) However it seems as if FMP12 doesnt recognize the position of the first CR Also, a question: is the FMP12 symbol ¶ the way to define a CR in a text field? I have tried both as ¶ or as "¶" and the result is always 0 doing the pattern count. Also I tried to do a pattern count using Char(13) and I receive 0 result (pattercount;fieldname; Char(13)) As FMP doenst have the Latin1 import option maybe this is the reason for te mistake in my script. I need to extract the ID from this short message and all others. the problem is the CR seems to be the only way to define the end of the "middle" script pattern but it doesn't work Could anyone please help? thanks in advance
Raybaudi Posted December 13, 2012 Posted December 13, 2012 Can you tell us wich is the result of this calculation: Code ( Middle ( YourText ; 17 ; 1 ) ) ( based on the example that you posted )
dkey Posted December 14, 2012 Author Posted December 14, 2012 Soryy but I dont understand exactly: Code refers to what? In the Script section choosing Look as Category Names rather than the standar "Functions", Code des not appear as a Script function However the works as you suggested. It gives me various values different fromeach record. but I don't understand what the numeric value refers too. Is it the first CR I am looking for? If this is the case based on the example the result is 13 and it should be 16 instead. If I remove code as Code as Middle ( MyText ; 17 ; 1 ) I receive letter D which is the first letter after the first CR which instead is at position 16 also Middle in this example begins from "ID: " which I could later erase in every field setting the script as a "text" result and not as a number which is what I really need. Mi pare che lei è Itlaino anche se roma è piena di stranieri .... Non riesco a capire questo problema in nessun modo What I do previously: I import a folder where all the messages are stored as text files in TextWrangler. The Text content gives me everything in the Message:I use some pointers to choose wich part of the message I want to place in various fields. This because all messages have the same words sequence therefore is easy (at least in thepry) to create scripts to define the only parts I need in the message. I believe FMP12 Advanced has a promblem with invisible chars if I import a folder as File Name, File Path Text content. I am also unable to get meaningful results with " " <blanc spaoce> in other words FMP gives me crazy result. If I dont import anything and use a Database where I actually type the text (as in the example) everything works. Therefore I am sure there is some enchoding problem I am unable to solve. E' Possibile? Can this be Grazie, Thanks
Rick Whitelaw Posted December 14, 2012 Posted December 14, 2012 "Code" is not a script step, but a function. A CR is, I believe, 13. Look up the Code function in Help. Very useful.
LaRetta Posted December 14, 2012 Posted December 14, 2012 Let ( [ start = Position ( MailsMessagesNew::Message ; ":" ; 1 ; 1 ) + 1 ; end = Position ( MailsMessagesNew::Message ; ¶ ; 1 ; 1 ) ] ; Trim ( Middle ( MailsMessagesNew::Message ; start ; end - start ) ) ) Hi dkey, try this calculation. :^) I've never had to store a carriage return into a text field.
Raybaudi Posted December 14, 2012 Posted December 14, 2012 Hi LaRetta he said: "I have tried both as ¶ or as "¶" and the result is always 0 doing the pattern count." So I think that there is another hidden char.
comment Posted December 14, 2012 Posted December 14, 2012 After importing a several hundred files from Textwrangler Latin1 encoded, they become UTF-8 in Filemaker as there is no "Latin-1" import facility as I understand it I don't think the encoding is the issue here. What's important is the choice of the paragraph-delimiting character. It seems like your files are set to use 'Unix (LF)' rather than 'Classic Mac (CR)'. When such file is imported into a text field, the paragraphs are separated by the Line Feed character (ASCII 10) rather than by the Filemaker's native Carriage Return (ASCII 13). A simple operation of = Substitute ( YourTextfield ; Char ( 10 ) ; ¶ ) should cure the problem. Or just use Char ( 10 ) in your calculations instead of ¶.
Recommended Posts
This topic is 4362 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 accountSign in
Already have an account? Sign in here.
Sign In Now