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

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

Recommended Posts

Posted

I have a text field that contains an essay. I need to parse each of the essay's paragraphs into separate records in a different table. The paragraphs are delimited by double line feeds. If I copy the essay into BBEdit, I can identify and select each of the paragraphs by running the expression \r\r.+    But I have no idea how to accomplish something similar in FileMaker. Can someone help? Thanks.

Posted (edited)

you could use 

GetValue ( listOfValues ; valueNumber )

if your paragraphs are double returned — ¶¶

Then increment by two : 

GetValue ( txt ; 1 )

GetValue ( txt ; 3 )

GetValue ( txt ; 5 )

Edited by rivet
Posted
1 hour ago, rivet said:

if your paragraphs are double returned — ¶¶

Then increment by two : 

GetValue ( txt ; 1 )

GetValue ( txt ; 3 )

That would work only if a paragraph will never contain a single carriage return.
 

I would suggest something like (pseudocode, untested):

Set Variable [ $parentID ; Parent::ParentID ]  
Set Variable [ $paras ; Substitute ( Parent::Textfield ; [ "¶¶" ; Char ( 31 ) ] ; [ ¶ ; Char ( 30 ) ] ; [ Char ( 31 ) ; ¶ ] ) ]
Go to Layout [ Child ]
Loop
  Set Variable [ $i ; $i + 1 ]
  Exit Loop If [ $i > ValueCount ( $paras ) ]
  New Record
  Set Field [ Child::ParentID ; $parentID ]
  Set Field [ Child::Textfield ; Substitute ( GetValue ( $paras ; $i ) ; Char ( 30 ) ; ¶ ) ]
End Loop
Go to Layout [ original layout ]

 

Posted

Perfect! Your untested pseudocode worked perfectly on first pass, with no debugging (which is something that rarely happens with my code). That's exactly what I needed.

Thanks very much to both of you.

 

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