Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

Performing multiple Find/Replace style Finds on same Text Field


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

Recommended Posts

Posted (edited)

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 by Guest
Posted (edited)

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 by Guest
Posted

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.

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