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

Data merge with conditional text

New Here ,
Mar 24, 2011 Mar 24, 2011

I'm new to InDesign scripting. Very new, in fact. I'm willing to learn, but my main motivation at present is to solve a particular issue. Surely this issue has come up before. I'd love to know if anybody has encountered it or if it is possible to accomplish through scripting.

I want to merge data onto a gift pledge card. The exact text on the gift card will depend on the data being imported. For example, somebody who has given in the past will receive a message such as, "Thank you for your gift of $xxx." However, a person who has NOT given into the past will receive the message, "Please consider giving this year." The condition is the field prior_gift. If it's above 0, then the first message is displayed.

This seems like a natural use for scripting, but, in my searches so far, I've found no references to using conditional text and data merges together in scripting. So, would this be a relatively simple task to accomplish?

Thanks for any help you can give!

TOPICS
Scripting
4.1K
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
LEGEND ,
Mar 24, 2011 Mar 24, 2011

It would be a lot easier to just use a spreadsheet function in your input. =IF(A1=0,"Not given","Gave "&A1&" dollars") or whatever.

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 ,
Apr 27, 2011 Apr 27, 2011

the data merge feature with indesign only brings in text which was in the original data file itself - it doesn't know how to parse or interpret it to behave differently upon seeing certain results. that is, it doesn't run database queries such as if-else statements - it will only import text which was originally in the data file.

however, there are plug-ins to indesign that CAN do this but they cost BOATLOADS. are you printing this yourself or are you sending this to a commercial printer? if the latter, have you discussed your print solution with the printer, as they may have a plug-in that can do this type of data merging, and all you would have to do is provide the printer with a packaged native file, along with the data and instructions as to what has to change... and for goodness sake see a proof of it!!!

If the answer wasn't in my post, perhaps it might be on my blog at colecandoo!
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
Guest
May 10, 2011 May 10, 2011
LATEST

You can do this with a simple search and replace. It can be scripted, if you do this often.

You can data merge the sum as "GIFT:500" or whatever and then use search and replace to replace any "GIFT:0" with "Please consider giving this year." . Then use GREP search to replace "GIFT:(\d+)" with "Thank you for your gift of \$$1."

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