October 14, 201015 yr I have a long stream of based text that I need to parse information from. eg:- 0 This is a record 123 1 This is another record 456 . . etc.. I need to extract the data 0, 'This is a record', 123 1, 'This is another record', 456 . . etc.. My thought is to put this text in a global field and then perform a find/replace style find within the text field, searching for the tag, setting a $start variable to ActiveSelectionStart +4 (to get to the start of the text jumping over the ) Then searching for and setting $length to ActiveSelectionStart - $start. It should then just be a case of using the Middle function to get the text and put it into a record. Performing the same task for the other tags. Unfortunately firstly I'm having difficulty selecting a field to perform a 'find/replace' style find from within a script. The script step says Go To Field and then the next step is Perform Find/Replace '' However, the script returns the error The Find/Replace Option 'Current Field' requires a selected field. Surely that's what the first step does ? If I click into the field before calling the script it works fine (for the first tag). I'm also struggling, after setting the script puts the first recovered data into a field, getting the cursor back to the last position in the original (long text stream) text field to continue the search. I know the cursor position by using ActiveSelectionStart, but there's no option to 'SetCursorPosition' or anything similar. If anyone has any better suggestions I would be very grateful and open to suggestions. Thanks Gary. Edited October 14, 201015 yr by Guest
October 14, 201015 yr Where is this text coming from? Filemaker can import XML sources directly (given a suitable XSL stylesheet).
October 14, 201015 yr Author It's coming from an obscure piece of software from a client. I don't think the file is pure XML unfortunately and Filemaker has a problem importing directly into records because some of the text doesn't register. Because each problem line is different it's difficult to do a find and replace to remove them. All I'm after are the 3 bits of information coloured red below. The text that's repeated for 800 records shown below:- [color:red]107 102 Statustext 0 320 false 1 false A16 false -1 [color:red]Startbereit [color:red]Ready to Start Edited October 14, 201015 yr by Guest
October 14, 201015 yr It's certainly possible to extract the data - see: http://fmforums.com/forum/showpost.php?post/289685/ If you use a script variable to count the records, you could have the script create the 800 records automatically in a loop.
October 14, 201015 yr Author I think "position" may be the function I was looking for, many thanks :)
Create an account or sign in to comment