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

Data merge: Replace cell data by Predefined text block

Community Beginner ,
Oct 23, 2017 Oct 23, 2017

Hi everyone.

My question might appear tricky, and this is why I'm asking the community.

I am building a catalogue through data merge, and have a "field" on my csv file for each product that simply can't be used as plain text: The Color data.

I am adapting the previous document from Illustrator, where I have a block of text made of webdings (Yes, I know) of each color, followed by the actual text code.

It is presented like this:

Screen Shot 2017-10-23 at 18.50.26.jpg

What I'd like to know, is if there is a way to map a data-merge field to each actual combination of text (the lines in the image below), or series of colored and styled text information, so that each "x" in each of my columns for each color is replaced by its corresponding string (the colord bullet + color code and color name) during data merge.

Screen Shot 2017-10-23 at 18.50.41.jpg

Ex: I have each product with an "x" in each column for the corresponding color, and I tell InDesign each column has to be replaced by this block of predefined text corresponding to the color code.

I was hoping there might be a script that can achieve that with some tweaking (I have basic javascript knowledge but learn fast) or maybe a native function in InDesign ?

Any help or direction where I can search to is highly appreciated!

2.0K
Translate
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

People's Champ , Oct 24, 2017 Oct 24, 2017
Translate
People's Champ ,
Oct 23, 2017 Oct 23, 2017

Hi,

Unless I am wrong there isn't any native feature that would generate such color patches during the datamerge.

A script is a good solution but you problem may be then that you would have a bunch of "x" once datamerge is done without any connection to the genuine color. Or you may tag every single color, one by line, and so the script will process every single line to discard those without a "x" and tweak the others.

Or you may consider third parties plugin such as EasyCatalog which does that very well

FWIW

Loic

Translate
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 ,
Oct 23, 2017 Oct 23, 2017

I'm trying something simpler now, as I went on another path. I've created a library item for each of the color text strings (I recreated each of them in InDesign from Illustrator, since copy/paste doesn't work from one software to the other...).

Now I would only have to build a script that search for, let's say, "102color" text in the indesign document, and replace each instance by the item called "102color" in my InDesign library. It feels like it's the right way to go about this (at least more achievable, right?). Any chance you know how I can build such script?

Translate
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
People's Champ ,
Oct 24, 2017 Oct 24, 2017
Translate
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 ,
Oct 24, 2017 Oct 24, 2017

Another option, since you have the color strings as illustrator files, would be to merge them directly into the document as images.

Translate
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 ,
Oct 24, 2017 Oct 24, 2017

Out of the box, the data merge process of Indesign needs data to produce a layout. There are no conditional mechanisms that could create content based on certain criteria. But, there are ways to enhance the capabilities.

Here is a brief example: if "431" was in the data file, there is no way for Indesign to generate the text "Deep Blue" into the layout. But if "431" or "Deep Blue" is present in the data source, this information could trigger a GREP style to then colorize the bullet to the specific blue color.

Translate
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 ,
Oct 24, 2017 Oct 24, 2017

I feel like you could achieve the color change with a GREP style if you make the circle a text character such as a bullet. The tricky part would be the circles that are half and half.

Translate
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 ,
Oct 24, 2017 Oct 24, 2017

The half circle bullet could be handled with a font like Wingdings 2 that has the left half and right half glyphs.

Translate
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
People's Champ ,
Oct 24, 2017 Oct 24, 2017

You are all right but that would imply data are design centric which is in best case scenario possible but not really desirable most of the time. I think imho that data should be preserved from any design concern.

Translate
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 ,
Oct 24, 2017 Oct 24, 2017

Indeed as Loic mentioned, I believe his script solution posted here  is more elegant and slightly more suitable for my case, for those reasons:

- Adding a library item similar to the previous ones with new color code (in case the client adds some next year) is slightly easier and makes the whole thing more "portable"

- It avoids the hassle of creating over a 100 GERP styles for each scenario, each of them specific to the name string for each color name.

- They also have 2 versions of the catalog that I can apply the same "recipe" to.

- Having the whole string as my cell data ("n 100 | Noir" for example, n being the webding/Zingbaf character) could cause problems for csv files: special characters are often not very well handled (to be confirmed).

This technique however poses 2 main issues:

- Editing library items is a painful process, and the simple task of reducing font size (as I will probably have to do) is tedious.

- I currently have a spacing / tab issue, as for some items I have to display 3 color codes side by side over 3 lines which is complicated to perform as Library items retain their frame size when added via script as anchored objects. Currently trying to tackle that with GERP actually (on smaller scale), or simply by changing layout or data itself (maybe single spaces only after the color code in excel?).

Translate
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
People's Champ ,
Oct 24, 2017 Oct 24, 2017

borisc58516170  a écrit

This technique however poses 2 main issues:

- Editing library items is a painful process, and the simple task of reducing font size (as I will probably have to do) is tedious.

- I currently have a spacing / tab issue, as for some items I have to display 3 color codes side by side over 3 lines which is complicated to perform as Library items retain their frame size when added via script as anchored objects. Currently trying to tackle that with GERP actually (on smaller scale), or simply by changing layout or data itself (maybe single spaces only after the color code in excel?).

Indeed Library Items can be a pain if you have dozens of assets. That's why I woud probably work with Snippets on my own. I mean I would try to have one generic item that I could tweak on the fly through script. But at some degree, you would still need to store color values and labels that a script could parse and apply.

Translate
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
People's Champ ,
Oct 25, 2017 Oct 25, 2017
LATEST

And as for xml, it's interesting if you envision XSLT as a way of calling the right patches (building the appropriate xml structure on the fly) depending on the data and so bringing the conditional processing datamerge lacks. But at some point I think that all those efforts would be easily compensated by a third party plugin imho.

Translate
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
Adobe Employee ,
Oct 24, 2017 Oct 24, 2017

Hi,

While all of the above are totally valid points and great suggestions, I would like to add two more points... not sure if they will work out perfectly but no harm giving a try.

1. Using XML to generate such a kind of layout rather than Data Merge.Import XML in InDesign

This would require learning on how to create automatic layouts using XML using both text frame tagging and placeholder text tagging

2. Text in CC libraries. With CC 2018, live text (objects) can be transported from Illustrator to InDesign and vice versa.

-Aman

Translate
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