August 24, 20214 yr 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.
August 24, 20214 yr 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 August 24, 20214 yr by rivet
August 24, 20214 yr 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 ]
August 24, 20214 yr Author 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.
Create an account or sign in to comment