If the first listed item is always marked with an asterisk, this should work for part of what you need:
But I can't help thinking that the * shown is a typo in your post...
Im sorry, it should be a bullet not an asterisk. I have corrected my post, thank you.
Essentially, we have a text field with a long description in our database and we want to use that same text in an html format for our web store.
Yes, but I can easily put up a method that works for the text shown but that is not generally applicable to all the different blocks of text that you might put into this field in different records.
What I see here is text that starts with a bullet as the first visible character of the first line followed by more of the same followed by a blank line followed by an additional paragraph or sentence.
Will this always be the case or will there be variations?
I'm thinking that you'll need to use either a looping script or a recursive custom function to loop through your text in order to put HTML tagged text into a separate field with the correct tags in the correct place.
What is consistent is that there are bulleted items in every description along with the text description, below. The list items are variable as is the additional text.The strategy I thought out was to somehow use the patterncount function to determine how many bullets, the position function to determine the last and first bullet locations, then replace them with the <li> tags. Of course, the unordered list needs the opening and closing tags as well <ul> </ul>
I think he has multiple typos since the html will render in a browser like this:•* Highly Nutritious•• Economical•• Organic
I think I need someone who is skilled at using theposition and middle functions. I keep trying though.
Then it would appear that this may work for you:
Let ( [Part1 = "<ul>¶<li>" ;
ListStart = Position (ListField; "•" ; 1 ; 1 ) ;
ListStop = Position (ListField; "•" ; Length ( ListField ) ; - 1 ) ;
MidList = Substitute ( Middle ( ListField ; ListStart + 1 ; ListStop - ListStart ) ; "¶•" ; "</li>¶<li>" ) ;
TextEnd = Middle ( ListField ; ListStop + 2 ; Length ( ListField) ) ;
Break = Position ( TextEnd ; ¶ ; 1 ; 1 ) ;
ListEnd = Left ( TextEnd ; Break -1 ) & "</li>¶</ul>¶ <br>" & ¶ & Right ( TextEnd ; Length ( TextEnd ) - Break )
Part1 & MidList & ListEnd
Genius! Thanks, worked perfectly. Kudos
For those interested, I used FileMaker Advanced's Data Viewer to build and test this calculation.
I added one more term to the let function:
Let [ ListField = "• Highly Nutritious.....
with ¶ added to provide the needed line breaks and then I could add one list variable at a time and confirm that it was returning the correct value before adding the next one...