• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Data Merge. Need to embed a carriage return placeholder in CSV to make hard breaks in paragraph

Community Beginner ,
Aug 04, 2022 Aug 04, 2022

Copy link to clipboard

Copied

I've seen this question asked many ways... but I don't think the GREP discussions were about data merge files.  

And I've seen it here about XML data, but this method doesn't work either (https://community.adobe.com/t5/indesign-discussions/including-carriage-return-with-xml-table-data/m-...)

 

I have a text file for data merge.

I can make it csv or tab delimited or whatever else you tell me.

One of the fields is a formatted paragraph with CRs. So it forces a hard break in the txt file.  DataMerge stops reading that record at that CR.  So I can string it all into one line without any issue.  On my end, I can replace the CR with a token.

 

I've tried <br/>, and &#13; and &x0d; and all those just appear as literals in my merged data.

I've watched the "Solis" video (both).

Someone please tell me what I need to do - PLEASE!

Thanks in advance!

TOPICS
How to

Views

395

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Aug 04, 2022 Aug 04, 2022

Well, what I always do when I'm in your shoes is:

1) In my text editor, I replace all my hard breaks with something weird that doesn't appear in the document (Thai currency symbol, Linear B, something that would never appear in the document I'm working on) and save

2) Merge the document in ID

3) Replace the "something weird" with a hard return using Find/Change (or a soft return, if that's more appropriate to the circumstance)

 

 

Votes

Translate

Translate
Community Expert ,
Aug 04, 2022 Aug 04, 2022

Copy link to clipboard

Copied

Well, what I always do when I'm in your shoes is:

1) In my text editor, I replace all my hard breaks with something weird that doesn't appear in the document (Thai currency symbol, Linear B, something that would never appear in the document I'm working on) and save

2) Merge the document in ID

3) Replace the "something weird" with a hard return using Find/Change (or a soft return, if that's more appropriate to the circumstance)

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 06, 2022 Aug 06, 2022

Copy link to clipboard

Copied

thx, but this doesn't really help me. 

Hope someone else has something better.

I already said I can replace the CR (carriage return) with something else, so no need for step #1.

This is something that needs to be done "automatically" with some sort of macro/script/JS/GREP style/etc.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 06, 2022 Aug 06, 2022

Copy link to clipboard

Copied

DataMerge is a very simplistic feature. The only way to handle your problem is as Joel described. Add some glyph or string (I tend to use "N/L") and then do a Find/Change after the merge.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 06, 2022 Aug 06, 2022

Copy link to clipboard

Copied

GREP styles don't replace characters; we've seen some pretty edge-case uses of GREP Styles around here, so I don't want to say it's completely impossible, but it's almost completely impossible to use a GREP style to achieve what you want. 

 

These actions are scriptable, of course. I have never written my own script to automatically perform a regex on one's entire document, but the syntax looks simple enough:

 

app.changeGrepPreferences = NothingEnum.nothing;

app.findGrepPreferences = NothingEnum.nothing;

app.findGrepPreferences.findWhat = 'heres_where_you_put_your_token';

app.changeGrepPreferences.changeTo = '\r';

app.activeDocument.changeGrep();

app.changeGrepPreferences = NothingEnum.nothing;

app.findGrepPreferences = NothingEnum.nothing;

 

I didn't bother to test that, it's just copied and pasted from another "how do I script a regular expression" thread. It's not "automatic" because you have to run the script. I can just barely imagine a need for automagical replacement so dire that you took advantage of the InDesign Startup Scripts folder to have your script run on everything... or perhaps you make a keystroke in the Keyboard Shortcuts preferences that automagically ran the merge and performed the regex with a single keystroke? I don't know. 

 

Alternately, it's been a long time since I looked at any of InDesign's catalog plug-ins, but Peter is 100% correct when he calls Data Merge a "simplistic feature." Maybe InCatalog or EasyCatalog has what you need? Kind of overkill for your application, and also pricey to automate a single find/replace operation. Hiring one of the local script-guns-for-hire might be a better bet, if you can't turn my copypasta code above into something that meets your needs.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 06, 2022 Aug 06, 2022

Copy link to clipboard

Copied

That's such a simple find/change operation that it hardly merits the creation of a script. Write the query once, save it and recall it as necessary. Might take ten seconds longer to open the dialog and load the query than it would to run a script with a keyboard shortcut.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 06, 2022 Aug 06, 2022

Copy link to clipboard

Copied

LATEST

ok guys, thx

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines