Jump to content

I need to split a multi-line text field into an array based on the line break as the


Recommended Posts

I need to split a multi-line text field into an array based on the line break as the delimiter. I have tried:

var data = Field("BenefitsList");

var eachLine = data.split(/\n/g);

and other regular expressions to no avail. Does anyone know how to split on a line break in a multi-line text field?

What does the original data look like? Can you post the data file here? Also, is this a data file being generated by a web-to-print system such as MarcomCentral?

Link to comment
Share on other sites

The input data is being generated by Marcom Central. The user is entering their information into the field as I try to show on attached screen shot. I attached the FP file and my sample data. I do not know a way to test multi-line fields within Fusion Pro.

 

I am using RULE_insertBenefitBullet to create an array based on the line breaks, but marcom central is not recognizing the '<br>'. We have uploaded the files using other regular expressions with \r and \n trying to get the delimiter. None have been successful yet.

I do not know what delimiter to look for in the multi-line field.

 

Your help is much appreciated, Dan.

FP files.zip

Link to comment
Share on other sites

The input data is being generated by Marcom Central.

Then this is a MarcomCentral-specific question. (It's specific to how MarcomCentral generates data from its multi-line text editor, as opposed to how another web app might generate something similar, or to what someone might generically refer to as multi-line input.)

 

Therefore, if you ask your question in the MarcomCentral forum, or contact your CPM, you'll have a better chance that someone who knows more about MarcomCentral will see it.

The user is entering their information into the field as I try to show on attached screen shot. I attached the FP file and my sample data. I do not know a way to test multi-line fields within Fusion Pro.

We need to find out exactly what are the contents of the data field in the data file that MarcomCentral is generating. Try making a rule that returns that field, but withOUT the "Treat returned strings as tagged text" box checked, and typeset that rule into the output. Then we should see the actual raw field value in the output.

Link to comment
Share on other sites

I imagine it has something to do with how FP/MarcomCentral is interpreting tagged text. As in, maybe the break tags themselves (<br>) in your data are being converted to HTML entities: <br>

 

This is a sort of "catch all" regex that will replace a variety of page breaks with "<br>" and then create an array by splitting on the "<br>":

return Field("BenefitsList").replace(/<p>|\r|\n|<br>|<p>/g,'<br>').split('<br>');

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...