Data Merge - Conditional Space?

how can I insert a conditional space in a mail merge?
or more simply, when the first, last names are added you must type a space between them or they merge such as "firstlast". And yes, if I put a space between the two fields they merge properly, but when an entry does not have either a first name, or does not contain any first OR last the merge leaves the space on that line. This does not comply with the Content Placement Option setting which is designed to remove 'blank' lines. It doesn't remove because it needs a conditional space such as: If no first name, then no space... etc
anyone? bueller?! anyone?

Excel will do a conditional name formatting for you.
=if(and(isblank(CELLFIRST),isblank(CELLLAST)),"",trim(clean(CELLFIRST&" "&CELLLAST)))
This would be a "name" column.
First quotes are quotequote for a blank, second quotes are quotespacequote for the space between names.
TRIM function does a nice job killing leading spaces, double spaces, etc. CLEAN removes non-printing characters which suck unless you put them in on purpose.
J

Similar Messages

  • Conditional fields with Data Merge

    I have, what I believe, would be a common question for people using Data Merge in InDesign for business cards.
    I have multiple phone fields, with a small-caps letter to indicate what type (mobile, direct, fax, etc.), i.e.:
    M <<Phone Mobile>>
    D <<Phone Direct>>
    If an employee has only one phone line, how can I make it so that the entire line will be omitted from the final merged doc?
    In the past, I've just gone through the final set and quickly removed extra lines/characters, but I know there's a way!
    Thanks.

    You could also do a find/replace (or, rather two of them if needed) to remove the leading character.
    So for your "D" phone number example, you would do a F/R after the merge like so:
    D <FEFF>\r
    If I remembered the syntax correctly, anyway. It finds the literal 'D' followed by a space, followed by an empty merge field marker, followed by a return. Replace would be with nothing.
    Else consider using a merge product that has the conditional capabilities. Em Software makes one such plug-in. I use Xdata for QuarkXpress a good bit, their InDesign counterpart is called InData.
    Mike

  • Data merge with conditional text

    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!

    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!!!

  • How to build conditional text from a data merge

    Hi there
    I'm hoping this is not a long shot but I do have a rather large ask (I think). 
    I cannot figure out how to create conditions on values.
    We have two areas that require conditional text. See these areas on the attached image. 
    Features offered - up to 6.  These are identified by defining each feature with a letter, eg 'n' stands for tent site and 'L' stands for seasonal work,  and
    Room type offered - four colour codes with this. These range from "not made up", "made up", "ensuite/madeup" and "ensuite".
    The tab delimited file contains numerous columns for each room type - single, double, twin, share and dorm rooms that offer the 4 room type categories - see point 2 above. 
    I cannot figure out how to clarify the conditions I require for the conditional text.
    Do I start with making 4 conditions for each room type colour and so-on for the rest of the room types ie single not madeup, single madeup, single madeup ensuite and single ensuite? 
    And if so, how do I create these using the correct conditional code?   Does GREP have anything to do with this and do I need to use its metacharacters like \?
    Can someone perhaps start me off?
    The same goes for the features.  The features are displayed in the spreadsheet per column with either a 'yes' or a 'no' displayed.
    I hope I have provided enough information to get some assistance.
    Thanks so much.

    Tag Design wrote:
    Hi there
    I'm hoping this is not a long shot but I do have a rather large ask (I think). 
    I cannot figure out how to create conditions on values.
    We have two areas that require conditional text. See these areas on the attached image. 
    Features offered - up to 6.  These are identified by defining each feature with a letter, eg 'n' stands for tent site and 'L' stands for seasonal work,  and
    Room type offered - four colour codes with this. These range from "not made up", "made up", "ensuite/madeup" and "ensuite".
    The tab delimited file contains numerous columns for each room type - single, double, twin, share and dorm rooms that offer the 4 room type categories - see point 2 above. 
    I cannot figure out how to clarify the conditions I require for the conditional text.
    Do I start with making 4 conditions for each room type colour and so-on for the rest of the room types ie single not madeup, single madeup, single madeup ensuite and single ensuite? 
    And if so, how do I create these using the correct conditional code?   Does GREP have anything to do with this and do I need to use its metacharacters like \?
    Can someone perhaps start me off?
    The same goes for the features.  The features are displayed in the spreadsheet per column with either a 'yes' or a 'no' displayed.
    I hope I have provided enough information to get some assistance.
    Thanks so much.
    Maybe I'm missing something, but I can't see why you need conditional text. I can see that you may want to color each property in each category differently, to stand out for quick visual communication.
    If each feature (attribute) of each property or venue is represented in one spreadsheet row (record,) you can use data merge to create the whole entry for each property. For example, a property may offer two types of rooms - single and double, and the single may be available as "not made up" only, while the double is available as "ensuite/madeup" and "ensuite."
    In the spreadsheet, in the row for the Acme Inn property, which only offers single not-made-up and single ensuite/madeup rooms, and for the Ajax Hotel property which offers single made-up, single ensuite/madeup, and single ensuite rooms, the cells that contain the data for the merge fields would look like this:
    Property ID
    single not-made-up
    single made-up
    single ensuite/madeup
    single ensuite
    Acme Inn
    $50
    empty cell
    $75
    empty cell
    Ajax Hotel
    empty cell
    $65
    $75
    $85
    On the data-merge layout, each room type's label would be followed by all four data-merge field placeholders, with colors applied, so the single would look like:
    Sgle: <<single not-made-up>> (red) <<made-up>> (yellow) <<ensuite/madeup>> (green) <<ensuite>> (blue)
    NOTE: The colors are applied with named character styles to the data-merge layout in InDesign.
    [EDIT] BAH! I applied colors to the text when composing this post, but they were removed when I posted. [/EDIT]
    When you set up the merge with Remove Blank Lines for Empty Fields enabled (checked) so the empty cells are ignored, the result resembles this:
    For the Acme Inn:      Sgl: $50 (red) $75 (green) $85 (blue)
    For the Ajax Hotel:    Sgl: $65 (yellow) $75 (green) $85 (blue)
    The separator character between the prices in your example is a special issue. It could be solved in the spreadsheet by creating calculated columns between the price columns, with "IF" formulas that test for values or empty cells and display the separator or nothing. If you choose this method, you'd need to insert fields between the placeholder fields, to hold the calculated fields' contents.
    Another approach here would be to follow the data-merge process with a GREP script that inserts separators where they're needed.
    Search Google for terms like "InDesign data-merge tutorial," "InDesign data-merge remove blank lines," "InDesign multiple records per page," and similar phrases without quotes.
    HTH
    Regards,
    Peter
    Peter Gold
    KnowHow ProServices
    Message was edited by: peter at knowhowpro

  • How can I use data merge, within a master, within a book?

    Hi all,
    I am producing an 84pp catalogue for multiple brands.
    I have it set up as:
    1x .indd document per spread
    Master styles within one .indd document for black text, white text etc.
    Book setup to contain all of the .indd files to make up the 84pp book
    Now, my problem is I have to change the footer text and references depending on the brand, so I can have the footers saying 'Call Brand A on 123 4567' or 'Call Brand B on 567 1234' and have various in-text references change from Brand A to Brand B and vice versa.
    I have a data merge on each of the masters in my .indd style source looking at a simple .csv of:
    Brand Name
    URL
    Phone Number
    Brand A
    www.branda.com
    0800 123 4567
    Brand B
    www.brandb.com
    0800 567 1234
    This works fine on the masters within the source .indd.
    But, when I close this master style source and go into another .indd document within the book (after synchronising) I see the <<Brand Name>> container but, when I export the documents it does not populate the book with the data - it keeps the containers.
    Obviously with a normal in-document Data Merge you'd click 'Create Merged Document' but I don't want to export each page, and I have PDF print presets / .joboptions file with settings for the book.
    Any advice on how to get this to work?
    Thanks!
    Andy

    I'm not really following the workflow here, but this seems like it might be better suited to Conditional Text than to Data Merge.

  • Inconsistent placement of anchored text frame in data merge document

    Just writing up this bug so that anyone else who encounters it can find out what's going on with less head-scratching.
    It seems that InDesign's data merge feature gets confused when there are anchored objects in a text frame that's anchored inside another text frame, which can result in:
    exported PDFs that don't match the InDesign preview when viewed in Acrobat (so, nasty surprises on some pages after exporting)
    InDesign previews that - bizarrely - show differently depending on whether you navigated to the preview by hitting the arrow keys in the Data Merge box or by entering a number.
    (sadly I can't provide a file for confidentiality reasons - but the problem point had multi-line data merge entries, a text frame that was anchored in another text frame of equal width, and anchored images and text frames in this anchored text frame)
    There were certain entires where, if I navigate to them in the preview using the 'next' and 'previous' keys, there was 4mm less space between the nested text frame and the previous line than if I navigate to it by entering the number. Exporting as a PDF through data merge used the variant with more space.
    Re-working the area in question so that the nested text frame wasn't needed seems to have removed the problem (but loses the ability to vertically align these elements in a fixed size frame that is in the text flow).

    You didn't say what version of ID, or whter a single or multiple record per page merge, but the Preview is known to be buggy for multiple records since CS5 and might be for single records as well.
    I have an annual directory that is built by data merge with one section in each listing as an anchored frame, and I've never had a problem, but it's not as complex as your description, nor do I ever merge to PDF (though I've heard here from several users that it's more reliable).
    One thing you might want to try is merging without the preview step, but do it from a "fresh" file by copying and pasting your placeholders into a new document. If the problem is with the preview it seems that it "infects" the file and even merging without touching the preview button may not work.

  • Data Merge Image Size

    If I create an image frame and place a data merge field in it, when I do the merge, it makes the image the size of the frame (i.e. either enlarged or shrunk to fit). I would like the image to come in at 100% so that I can use the "fit frame to image" command instead of having to first resize the image back to 100%. I've tried messing with the frame fitting options, but nothing seems to be of any use. If I'm missing something, I hope someone can fill me in.
    In the event that there isn't a way, is this something that can be scripted (after the merge, run the script to select all image frames, set the image size to 100% and then scale the frame to the image).

    In my testing, selecting preserve image and frame size and center in frame keptthe frame at the size drawn int the template and centered the image.  Unselecting the center image put the image inthe upper left corner, and it either left the frame alone if it was larger than the image, or expanded it (even off the page) if the image was too large. Most images seem to have been imported at 100%. I still can't explain why a handful are coming in at 50 or 25%, but there was a bug discovered a year or so ago that caused image scaling for particular pixel dimensions for one user (might have been a combination of dimensions and resolution) which might explain it. I'm merging into a 20 x 24 page filling nearly the entire page withthe frame, and there seems to be space to place these files at 100% so it's a puzzle.
    I haven't seen ay images scaled up...

  • Dependant(?) Data Merging

    Windows 7, InDesign CS4, Excel 2010
    I hope this makes sense:
         I have a project that involves making labels for about 800 SKUs. I've merged data before when making labels like this and it worked great (it's been a while though). Anyway, this project is different in that i have different labels depending on the product's category (i've got 10 categories) and I'm color coding them. I currently have an Excel Spreadsheet that is automatically updated from our inventory system/database that i am going to be pulling the data from that has ALL 800 skus on it.
         Basically, is there a way for InDesign to determine which label the entry should go into? Like, if i want to make all the labels for Category A (blue), will i be able to point InDesign at the spreadsheet and have it pull in those 80 Skus? Or if i tell it to merge, will it just merge everything in that spreadsheet?
         I'm trying to avoid having to get 10 different spreadsheets created (1 for each category) if at all possible.
    EDIT: I guess i should specify, the spreadsheet does have info about what category it is in.
    Thanks in advance!

    without plugins, data merge in indesign doesn't have purpose-built "triggers" as such (i.e. if a field = x, then y happens elsewhere). Ultimately, the text file in the data merge has to contain the necessary information that will appear in the output. However, the file that makes the txt file (e.g. excel) can have triggers such as if/else statements, and it is there where any information should be added as an additional field.
    For example, if a background in label A is to be blue and label B is to be green, files would need to be created for these different colored backgrounds (e.g. A.ai and B.ai) and then the trigger in excel would be if <<field>> = <<condition>> then <<a>> else <<b>> and would be its own column.
    There are dozens of plug-ins that may be able to do this, but seeing a return on investment from the purchase of the software (some can be quite expensive) is another matter.
    Apart from placing images, there are only two instances of data merge that can, in a way, be  triggered.
    1: GREP styles. If the incoming type fulfils the requirement of the GREP style, its appearance can be dramatically altered.
    2: Use of ligatures by the special font FF Chartwell, specifically the bar font. More information: http://colecandoo.wordpress.com/2013/09/04/another-use-for-ff-chartwell-plotting-x-and-y-c oordinates/

  • How generate QR codes in data merge?

    which format i need to use in a .csv or .txt files to generate the "Business Card" QR codes (using data merge) ??
    i haven't found it in the help!!
    Enhanced Datamerge
    You can integrate a QR code in the merged document. Following are the different types of QR code fields that can be added via Data Merge workflow:
    Plain Text
    Web Hyperlink
    Text Message
    Email
    Business Card
    To generate the QR codes the data entries in the .txt or .csv files, which are used as Data Source, are in the following format:
    Plain Text: In the QR code Column enter the text as it is.
    Web Hyperlink: URL:<url> (For example “URL:http://www.google.com”)
    Text Message: SMSTO:<Phone number>:<Message> (For example: “SMSTO:9818143551:Hi”)
    Email: MATMSG:\nTo:<email address> (example: “MATMSG:\nTO:[email protected]\nSUB:Hi;\nBODY:;;”)
    Though the data entries can be a mix of email, sms, hyperlink, or plain text type. Enter them in the .csv and txt field in the above mentioned format with a # sign on their column name. To generate QR codes, follow these instructions:
    Select Windows > Utilities > Data Merge.
    From the flyout menu, select Select Data Source.
    Select the data file with the QR field information. Click Open.
    Select the placeholder in the document.
    Click Create Merged Document icon to create a merged document.

    thank you very much Steve!
    I've try to use the sample of the best answer and doesen't work fine
    but in other answers i've found some links to VCard definition and this helped me to find the couple of errors in Monica's code (it's 3 little mispelled words or spaces-but this make the QR unreadable)
    VCARDBEGIN:VCARD\nVERSION:2.1\nN:Smith;John\nFN:John Smith\nORG:Adobe Systems\nTITLE:Engineer\nTEL;CELL:+919876543210\nTEL;WORK;VOICE:123456789\nADR;WORK:;;Str eet ABC;Seattle;Washington;98101;US\nEMAIL;WORK;INTERNET:[email protected]\nURL:www.adobe.com\nEND:VCARD
    corrected and tested by me:
    BEGIN:VCARD\nVERSION:2.1\nN:Smith;John\nFN:John Smith\nORG:Adobe Systems\nTITLE:Engineer\nTEL;CELL:+919876543210\nTEL;WORK;VOICE:123456789\nADR;WORK:Stree t ABC;Seattle;Washington;98101;US\nEMAIL;WORK;INTERNET:[email protected]\nURL:www.adobe.com\nEND:VCARD

  • Search for a string in Data Merge, then change the font color

    I'm working on a postcard-style invitation with the addresses on the back. So far, I've finished the invitation and the mail-side template with a Data Merge to a CSV file successfully. Now, as part of my design, I want all of the letter "b"s on the mail-side template (Data Merge) to be yellow. Using JavaScript is this possilbe? This is what I have so far, but something is wrong:
         app.findTextPrefences = NothingEnum.NOTHING as FindTextPreference;
         app.changeTextPrefences = NothingEnum.NOTHING as ChangeTextPreference;
         var myColor:Color = myDocument.colors.add();
         myColor.model = ColorModel.PROCESS;
         myColor.space = ColorSpace.CMYK;
         myColor.colorValue = [0, 0, 100, 16];
         app.findChangeTextOptions.caseSensitive = false;
         app.findChangeTextOptions.includeFootnotes = false;
         app.findChangeTextOptions.includeHiddenLayers = false;
         app.findChangeTextOptions.includeLockedLayersForFind = false;
         app.findChangeTextOptions.includeLockedStoriesForFind = false;
         app.findChangeTextOptions.includeMasterPages = false;
         app.findChangeTextOptions.wholeWord = false;
         app.findTextPrefences.findWhat = "b";
         app.changeTextPrefences.fillColor = myColor;
         app.findTextPrefences = NothingEnum.NOTHING as FindTextPreference;
         app.changeTextPrefences = NothingEnum.NOTHING as ChangeTextPreference;

    Hi,
    After setting preferences you need to call changeText() method, like
    myDoc.changeText();
    or
    myStory.changeText();
    But this is a static solution.
    You could use a dinamic solution by define a proper characterStyle and take advantage of nestedGrepStyle in style applied to this part of your design.
    So each character "b" could be applied with your characterStyle automatically, no need to run a script.
    Jarek

  • Data merge with football tickets. Printing causes out of memory errors. Can only print 10 at a time!

    Here's the deal. Printing football tickets for the local high school. 10 tickets per 8.5 x 11 sheet. All black and white. I couldn't data merge into one whole document of tickets because it was failing to do that. So, I end up with 3 documents. First two have 50 pages of tickets and the last has 37 pages.
    When I go to print, I can only print 10 pages at a time or InDesign straight up crashes or I get an "Out of Memory" error which is bull because I've got plenty of ram available (unless it's complaining about lack of HD space for some reason)
    Incredibly frustrating.
    Each ticket has 3 images on it. Two of the images are the same. Those two images are about 103kb .ai files. Very very simple. The other image is a TIFF that is about 76kb. So there are 1000 .ai files / document and 500 TIFFs.
    Here's a video I took of it ripping: http://www.youtube.com/watch?v=UCjvdmXuaYs&feature=c4-overview&list=UUf_1UFp80YLZJfCyIxXEg kg
    Also, when printing, I have the Send Data set to Optimized Subsampling instead of "All". That's not seeming to help.
    Any thoughts?
    IDCS 5.5
    OSX 10.8.4

    I just ran a sample on my laptop.
    AI file, duplicated, is 284k. Image is roughly 200k. The CSV has 2054 records, and the merged document with 10 per page is 250 megabytes. PDF is just under 50 megs.
    This laptop has only 4 gigs memory but has a lot of free disk space. It took a good amount of time to do the merge, a bit longer to create the PDF-X1a PDF.
    Mike

  • Data Merge: How to make images skip and continue after an ad or coupon?

    Using Data Merge to create a catalogue of images but through out the layout there are Ads spaces that I need to have control of the images not to be layout in that particular space. How do I go about  having that control using Indesign Data merge?
    thanks

    Thanks ja3754 for responding but you I went to a job interview and they explained  the procedure to me but did not showed me the steps. I told them it was news to me since I am aware of data merge doing business cards, variable letters and brochures but nothing to this level. So "unless they were not clear on the steps" according to them it is doable in data merge. But I am having a hard time finding any information on this procedure.

  • Data merge colour change

    Is there a way to change the text in a single data merge field to two separate colours?
    ie a script of some sort?
    thanks in advance

    You could run a GREP find/change after the merge to get rid of any extras. This will find any duplicate comma-space sets and replace them with one comma followed by one space.

  • Requested: Data Merge Glitch Solutions

    Hello,
    I'm using data merge in InDesign cs5.5 but the merged file does not resemble the preview - if it generates at all.  Most of the time InDesign closes unexpectedly trying to generate a preview.  I did try skipping preview as suggested by related posts, to no success.  From what I've read so far, data merge glitches are normal with InDesign but I still need to produce a working file.  Any kind of solutions to such glitches would be greatly appreciated.  I'd also like to attach the file I've done so far in case anyone wouldl like to review it, but I'm new to online forums (this being my first post) and as of now, can't figure out a simple way to go about it.  So here are screen shots of the preview and the merged file instead.  Please feel free to show me how to attach a file too, if so inclined.  Thank you, and hope to hear from you soon. 
    Preview:
    Generated file:

    So I'm having a similar issue. In Preview everything looks great. I get 23 pages of barcodes (or data merged information). I found there are 2 ways to do a merge. One is to create the merge, the other is to create PDF. I'm doing barcodes and need the file to be a PDF anyway, so it makes sense to go direct to PDF. My barcodes are 44 up on a sheet. If I create 1 page, 44 barcodes, I get the perfect 11x17 page with 44 barcodes. But if I try to do even 45 barcodes to go to the next page, I get a page full of the data box and no merged file. I tried without previewing. I then tried a new document and couldn't even get the 1 page of barcodes.
    I am working in CS5. I do have CS6, I'll go try that and maybe this has been fixed.
    I just tried doing a merge, not to PDF, and that was worse. That would put the first code on the page, correct position, next 43 codes next to the page, and keeps going until no space. The 45th code goes to page 2 and so on.
    So weird that this would work a few months ago, and then not now. Well I did this same job a year ago. I'll also check to see if there are maybe some CS5 updates I missed.

  • InDesign-Data Merge, Consecutive Empty Fields

    Hi there,
    I've been doing data merges in InDesign for quite some time now and I've always had this problem. I don't know of any other way, besides to go in and manually delete every line, to get rid of this issue.
    Here's my data block:
    <<First Name>> <<Last Name>>
    <<Spouse First>> <<Spouse Last>>
    <<Address 1>>
    <<Address 2>>
    <<City>>, <<St>> <<Zip>>
    Normally, I can just combine address 1 and address 2 into one line separated by a space and it's no big deal. I've tried using the merge option to delete the empty line, but it has never worked properly.
    My main concern is the second line. Not all records have a spouse associated with them and when merged, I have to go in an manually delete the entire line. Is there a way to fix this?

    I've tried using the merge option to delete the empty line, but it has never worked properly.
    That's odd; it's pretty much exactly what you are asking after. Can you tell us anything outside of "it has never worked properly"?
    Is there anything non-standard about your merge? (I.e. unusual text encoding, images, master pages, n-up merges, et cetera.) Can you take screenshots of your merge dialogs? Or give us a step-by-step rundown of what you are doing? Are you previewing before merge?
    I am an infrequent but long-time user of Data Merge, and I've always been able to use the "Remove blank lines for empty fields" checkbox without issue.

Maybe you are looking for