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

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

Recommended Posts

Posted

I have an instance where an imported text file needs to be parsed into separate blocks of text based on a user-designated delimiter character. For example, the user might specify "#" for the following text file:

[color:orange]First section of text. # Second section of text. # Third section of text. Sections can contain entire paragraphs; even multiple paragraphs. # Final section of text.

This would need to result in the following four separate records in FMP:

[color:orange]First section of text.

Second section of text.

Third section of text. Sections can contain entire paragraphs; even multiple paragraphs.

Final section of text.

I can use the Position and Left text functions to get the first occurrence, but what I need is an "extract text" function that can move forward each time it is called. Any advice will be greatly appreciated.

Posted

Very nice. I've never had occasion to use the Extend function so I have some research to do to fully understand this method. The drawback, if there is one, is that I'll have to determine the maximum sections that will ever be encountered (i.e., the 300 repetitions in your example), but I think that won't be a real problem.

Thanks very much for an elegant solution.

Posted

According the FileMaker 7 technical specs (which I don't know if they've expanded, but it's likely irrelevant for this question), you can have 32,767 repetitions for a field.

Posted

Oops -- there is a problem.

Upon further testing of receiveNSpit.fp7, I realized it also breaks the text on carriage returns as well as the designated delimiter. Although that would be a good method for many uses, it won't quite work for me.

I experimented with changing the in the calculated field to another symbol <@> but that only caused it to embed them in the results and break ONLY on CR's found in the text. The result I need is the opposite of that: leave the CR's in the imported text and terminate each imported text field only at the delimiter.

Would you have a suggestion for an enhancement to receiveNSpit.fp7? My only idea is to flag individual segments (with some "to be continued" symbol) and reconstruct the sections that contained CR's via a second script?

Posted

Try defining the repeating calculation as:

Substitute (

GetValue (

Substitute ( Extend ( g_RecieverField ) ;

[ ¶ ; "§" ] ;

[ Extend ( ChosenDelimiter ) ; ¶ ] ) ;

Get ( CalculationRepetitionNumber ) ) ;

"§" ; ¶ )

Posted

Thanks, Comment. -- It works!

I was just beginning to grasp how Soren's solution worked and now you've raised the bar. Exchanging the CR's, performing the extract and then exchanging them back -- in one statement!

Thanks much.

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