Lost In The Docs / Data Merge

Hey,
I'm trying to cook up a script that would add one of the items in my "data merge" into a text frame.
I have the code below, and I'm trying to understand the scripting help file, but so far I was only able to output some kind of resolve(....) text.
The "310-7251" is a name of one item in my data merge list. I want the text frame to contain it's.. um.. reference(?), the "<< 410-7251 >>" text that I would get if I did this manually, that would turn into the field's value when I would create a merged document.
What am I doing wrong?
var doc     
= app.documents.add();
var text_frame = doc.pages[0].textFrames.add();
text_frame.geometricBounds = [
'0pt', '115pt', '240pt', '240pt',
doc.dataMergeProperties.selectDataSource('E:/Temp/Merge-Test.csv');
text_frame.parentStory.insertionPoints[-1].contents += doc.dataMergeTextPlaceholders.item('310-7251').toSpecifier();

Well, I gave up and wrote a function that would traverse all the items and find the one I want.
With my extremely limited knowledge of the language, it seems there's a bug with the item() method; it doesn't accept field name string properly.
Here's my code that finally worked, but I'd love to know what I was doing wrong.. Thanks.
var doc          = app.documents.add();
var text_frame = doc.pages[0].textFrames.add();
text_frame.geometricBounds = [
    '0pt', '115pt', '240pt', '240pt',
doc.dataMergeProperties.selectDataSource('E:/Temp/Merge-Test.csv');
doc.dataMergeTextPlaceholders.add(
    text_frame.parentStory,
    text_frame.parentStory.insertionPoints[-1],
    get_field('310-7251', doc)
function get_field(field_name, doc) {
    var fields = doc.dataMergeProperties.dataMergeFields;
    for ( var i = 0, l = fields.length; i < l; i++ ) {
        if (fields[i].fieldName == field_name) {
            return fields[i];
    alert('Error: did not find any fields with name ' + field_name);

Similar Messages

  • Can we change the doc date in a purchase order ?

    can we change the doc date in a purchase order ?
    i have created PO with wrong dates but now want to correct it, but its not letting me do it ...why ?

    I don't think DOC DATES can be changed. You can only change the posting dates of the Goods receipt and Invoice documents as that is what matter for your financial consolidation.
    Regards,
    Ravi
    Note : Please mark the helpful answers

  • 200 line excell doc, data merge...

    So I have a excell doc with 200 names/addresses it's tab separated.
    I used data merge to bring it in, it made 181 or so pages. Which is fine. But each page contains the entire excell sheet, how do I edit it so that only one line per excell sheet appears on each of the ID pages?
    What I end up needing is a single line from the excell doc per page. Each line is a name/business/address.
    Im printing 200 invites each addressed indivudually.

    I'm not sure what you have in your Excel file, or how you have your DataMerge template set up, but here's what will work:
    What ever you have in the cell in the top row of each column in the Excel file will be the category that you will bring into InDesign. So, you might have:
    Name....................Address....................City/State/Zip
    …as your categories, and:
    John Smith............123 Main Street..........Anytown, California 12345
    …as the first row of records. Of course, you can split those up into as many fields as you like—first name in one cell, last in another, etc.—what ever works for you. Export that as a tab delimited text file.
    In InDesign, you select the text file as the data source, and as many cells you had type in on the first row will show up as placeholders. Make a text frame, click in with your text cursor and double-click on each placeholder to enter them into the text frame. Separate them in the way that you like (with spaces, returns, tabs, what ever you like).
    You seem to want one record per page, which is the default, so that works out well for you. Most of what you need will be in the Records tab, and you won't need to look at the Multiple Record Layout tab if you want one record per page. Have a look at the Options tab as well, and when you hit OK, you should have a page for each of your 200 rows of Excel data. If you don't, double-check the Excel page to see if you have any errors.

  • Places doesn't see the GPS data merged in via HoudaGeo?

    Last summer I used HoudaGeo to merge GPS data into our pictures before I uploaded them to Flickr.
    iPhoto 09 doesn't seem to see the GPS data these pictures had inserted, the only pictures that appear in Places are iPhone pics.
    Does Flickr and iPhoto use different GPS photo data? Is there a method I should use in the future with HoudaGeo to make sure iPhoto 09 sees my GPS data?
    Thanks.

    LarryHN wrote:
    1 - remember the rule - never make any changes to the contents of the iPhoto library or its structure using any program except iPhoto
    Good rule. But I changed the file, not the structure of the Library, so I would have thought iPhoto '09 would have found the data in the file.
    2 - try exporting one and reimporting it and see if it works - you will then have to delete the old one in the iPhoto trash and empty it
    Finally got back to my computer to test this. And yes, deleting a photo then re-adding it gives iPhoto the geotag.
    3 - I have not received '09 yet but I expect it to recognize any geocoding that was done prior to importing the photo
    Based on my limited experience it brings in the geo info from a photo that is imported into iPhoto '09, but not a photo that is already in the iPhoto library.

  • Lost in the docs again: JTextArea and EditorKit

    Greetings,
    As the topic title says: I lost track again in the Swing classes docs.
    I'm about sure a JTextArea (as well as a JTextComponent) uses a
    DefaultEditorKit, which in turn extends an EditorKit. I want that object
    because it carries some nice functionality I want to use.
    How, by Jove, can I get a reference to a JTextArea's EditorKit? Any pointers
    or clarifications are more than welcome because I'm also sure that I'm
    missing something in the MVC separation.
    kind regards,
    Jos

    I thought I've been there but obviously I don'tunderstand the 'mechanism' of this all.
    I don't really understand the mechanism either. I was confused why
    JTextPane and JEditorPane have a getEditorKit() method and JTextArea
    doesn't. It seems to me that the method should be defined in JTextComponent
    and overriden if necessary.
    Anyway I ended up searching the code to see where "editorkit" was
    used. Thats my trusty fallback.You're right, I should've done that too instead of just digging into the api
    docs. Sorry for saying so, but those Swing apis are quite inconsistent,
    if not incomplete, at several occasions. I always come here when I get
    stuck with them. Anyways, thanks again for doing what I should've done
    in the first place ;-)
    kind regards,
    Jos

  • Help!  I lost all the places data in iPhoto.

    I tried a restore from time capsule , but it didn't help. All my pics show the same place on the map. Yesterday everything was fine. I was trying to assign the same location to a group of pics today, and somehow I assigned it to the whole library!  Every pic shows the same location in the bottom right corner when you open them up. The date it was taken is still good. I figure the geodata is still good? Is there a way to reassign the places?

    No idea sinc I have no idea how you actually did this
    Things to try
    In the iPhoto preferences is look up places set to automatically?
    you can try Back up your iPhoto library, Depress and hold the option (alt) and command keys and launch iPhoto - rebuild your database although this does not sound like library corruption
    try restoring a slghtly older backup - be sre the one you are restoring is prior to the problem occuting
    LN

  • Extracting an image data merge field using only an indesign file and not document.dataMergeProperties.dataMergeFields

    Hi,
    I have kind of a weird requirement but I hope you guys can help out.
    I need to extract all the custom fields used in an indesign file without referencing the dataMergeProperties of a document. Sorry if this is a weird request it is just what I've been told (our system needs to not crash when people upload a variety of in design documents to generate high resolution jpg preview documents).
    I can already get all the text custom fields by looking for "<<" and ">>" in the text frames of a document but I'm having a really hard time finding the image custom fields.
    I tried looking at the rectangles for a given page but that didn't seem to help (but maybe i'm missing some there). I also tried looking at the graphics and images collection of a document but this seemed to return only graphics that are hard coded on the in design document and not the custom image fields.
    Any help would be appreciated!

    Uggg....
    Found the answer after I realized I was looking at the wrong SDK (5.0 instead of 6.0)
    I'm using the doc.hyperlinkPageItemSources property to get these images. It also looks like you can get the image data merge fields from DataMergeImagePlaceholder (but rememeber I couldn't access this).

  • Data merge to pdf - unusual result

    No matter what I do, I can't get InDesign to merge the content of my piece AND the data correctly.
    My project is simple.  I'm making a postcard that is exactly half the size of a sheet of letter paper.  There's a .25" margin.
    I created the text box that is exactly the correct size that shows where the address fields should be...
    When I do a document merge, the resulting .indd file is correct.  However, when I attempt the same data merge by selecting "export to pdf", the resulting file is way way off.
    See attached files.  The pdf doesn't even have two address fields, let alone a mirror of the content.

    Always use the camera icon to attach an image. This is something that needs to be fixed. I was attaching files via the attach link and FAIK, they never load. Stay queued forever.
    When you merge the data you should have a new ID doc. So if your original doc was mydoc.indd, the merged doc should be something like mydoc-1.indd. Export this to PDF. Should work.

  • How do I generate a data merge in InDesign from an excel spreadsheet which includes a barcode

    Can you please advise if the following process is possible within InDesign CS 5.5? (Mac OS 10.8.2).
    We need to create a data merge that includes a barcode. The data merge is for several thousand records.
    We have a customer-supplied Excel spreadsheet that contains seven fields, one of which is a number that ultimately needs to print as a barcode when we make the data merge in InDesign.
    As you would expect, the conventional six fields data merge perfectly - but we can't find a way to make the barcode print correctly within the data merge.
    We have investigated several possible solutions without success.
    Some solutions suggest a plug-in for Excel to convert the number into a barcode whilst still in the spreadsheet - but this doesn't come across correctly when we import the CSV file into the InDesign data merge.
    We have investigated certain third party software applications but none provide the full solution we require. Some, for example, appear to create the barcode within the Excel spreadsheet but don't produce the barcode correctly when we data merge in InDesign; and some will allow us to create a one-off barcode within InDesign but have no automated way of retrieving the thousands of Excel numbers and turning them into barcodes.
    We have also come across possible 'font' solutions but have had no success with these either.
    For a previous job we needed to produce we outsourced to a specialist mailing company, who assured us they produced the whole job (very quickly) within InDesign. They, understandably, won't tell us how they did it. But, given the speed with which they produced the job for us, we imagine - with the correct software - the whole process is easy to do.
    Can you please advise?

    HI MIKE
    Thanks again for your reply and your help with this.
    I've downloaded the barcode font from the link you supplied.
    I've tried three tests - and seem much closer to getting what we need. But I've come up against a couple of issues.
    TEST 1 - almost just to see if the downloaded font worked, I simply data merged our source csv file and applied the downloaded barcode font to the serial number in ID. Probably unsurprisingly, this produced a perfectly printed barcode - that wouldn't scan.
    TEST 2 - I manually added asterisks before and after the serial number in the first couple of fields and then tried the same process as TEST 1. It produced a perfectly printed barcode which this time DID scan correctly - but obviously the barcode had asterisks on it which I don't want. I just want the serial number. And with thousands of serial numbers we need the addition of the asterisks to happen automatically (which is where your text editor process seems the perfect solution, if we could get that to work).
    TEST 3 - Noting your comments about using parenthesis around the serial number, I followed your example of (123456). But Excel won't let me type a parenthesis. It lets me type the parenthesis but then instantly substitutes it with a - (hyphen) before the number in the actual serial number cell and no character at all after the number.
    If you have any suggestions or solutions for any of the above they'd be gratefully received! Thanks again for all your help with this.
    Kind regards
    Rob

  • CS3 Data Merge - Missing Fileds in Data Merge Dialog Box

    Indesign CS3 5.0.1, XP SP2
    Hi all,
    I have a document that I have applied a Data Merge to.
    I use a table in Excel 2003 with contact details, name, address etc...
    When I open the Automation> Data Merge Dialog box I no longer see the list off all the fields as in Excel.
    However, I can preview and create the mail merged document and place items using tags e.g <<Field 1>>.
    When I try to remove the Data Source InDesign always crashes But I can relink to a new Data Source, this does not solve the problem.
    Thank-you all for your time and help!
    Alu

    >>Did you perform the merge? Once you do, ID creates a new document. Which document are you looking at?
    I am using the original document, not the product of the mail merge.
    >>I assume it's a CSV file. ID can't use and Excel file for data merge.
    Correct.
    I have tried saving the document as an .inx file and then re-opening, but I still cannot view the .csv data merge fields from the Automation> Data Merge dialog box.
    Any Ideas? - thx for the response Bob & K

  • [CS5.5/6] - XML / Data Merge questions & Best practice.

    Fellow Countrymen (and women),
    I work as a graphic designer for a large outlet chain retailer which is constantly growing our base of centers.  This growth has brought a workload that used to be manageable with but two people to a never ending sprint with five.  Much of what we do is print, which is not my forte, but is also generally a disorganized, ad-hoc affair into which I am wading to try to help reduce overall strain.
    Upon picking up InDesign I noted the power of the simple Data Merge function and have added it to our repetoire in mass merging data sources.  There are some critical failures I see in this as a tool going forward for our purposes, however:
    1) Data Merge cannot handle information stored and categorized in a singular column well.  As an example we have centers in many cities, and each center has its own list of specific stores.  Data merge cannot handle a single column, or even multiple column list of these stores very easily and has forced us into some manual operations to concatenate the data into one cell and then, using delimiter characters, find and replace hard returns to seperate them.
    2) Data Merge offers no method of alternate alignment of data, or selection by ranges.  That is to say:  I cannot tell Data merge to start at Cell1 in one column, and in another column select say... Cell 42 as the starting point.
    3) Data merge only accepts data organized in a very specific, and generally inflexible pattern.
    These are just a few limitations.
    ON TO MY ACTUAL DILEMMA aka Convert to XML or not?
    Recently my coworker has suggested we move toward using XML as a repository / delivery system that helps us quickly get data from our SQL database into a usable form in InDesign. 
    I've watched some tutorials on Lynda.com and havent yet seen a clear answer to a very simple question:
    "Can XML help to 'merge' large, dynamic, data sets like a list of 200 stores per center over 40 centers based off of a single template file?"
    What I've seen is that I would need to manually duplicate pages, linking the correct XML entry as I go rather than the program generating a set of merged pages like that from Data Merge with very little effort on my part.  Perhaps setting up a master page would allow for easy drag and drop fields for my XML data?
    I'm not an idiot, I'm simply green with this -- and it's kind of scary because I genuinely want us to proceed forward with the most flexible, reliable, trainable and sustainable solution.  A tall order, I know.  Correct me if I'm wrong, but XML is that beast, no?
    Formatting the XML
    Currently I'm afraid our XML feed for our centers isnt formatted correctly with the current format looking as such:
    <BRANDS>
         <BRAND>
              • BrandID = xxxx
              [Brand Name]
              [Description]
              [WebMoniker]
              <CATEGORIES>
                   <CATEGORY>
                        • xmlns = URL
                        • WebMoniker = category_type
              <STORES>
                   <STORE>
                        • StoreID = ID#
                        • CenterID = ID#
    I dont think this is currently usable because if I wanted to create a list of stores from a particular center, that information is stored as an attribute of the <Store> tag, buried deep within the data, making it impossible to 'drag-n-drop'. 
    Not to mention much of the important data is held in attributes rather than text fields which are children of the tag.
    Im thinking of proposing the following organizational layout:
    <CENTERS>
         <CENTER>
         [Center_name]
         [Center_location]
              <CATEGORIES>
                   <CATEGORY>
                        [Category_Type]
                        <BRANDS>
                             <BRAND>
                                  [Brand_name]
    My thought is that if I have the <CENTER> tag then I can simply drag that into a frame and it will auto populate all of the brands by Category (as organized in the XML) for that center into the frame.
    Why is this important?
    This is used on multiple documents in different layout styles, and since our store list is ever changes as leases end or begin, over 40 centers this becomes a big hairy monster.  We want this to be as automated as possible, but I'd settle for a significant amount of dragging and dropping as long as it is simple and straightforward.  I have a high tollerance for druding through code and creating work arounds but my co-workers do not.  This needs to be a system that is repeatable and understandable and needs to be able to function whether I'm here or not -- Mainly because I would like to step away from the responsibility of setting it up every time
    I'd love to hear your raw, unadulterated thoughts on the subject of Data merge and XML usage to accomplish these sorts of tasks.  What are your best practices and how would you / do you accomplish these operations?
    Regards-
    Robert

    From what I've gleaned through watching Lynda tutorials on the subject is that what I'm hoping to do is indeed possible.
    Peter, I dont disagree with you that there is a steep learning curve for me as the instigator / designer of this method for our team, but in terms of my teammates and end-users that will be softened considerably.  Even so I'm used to steep learning curves and the associated frustrations -- but I cope well with new learning and am self taught in many tools and programs.
    Flow based XML structures:
    It seems as though as long as the initial page is set up correctly using imported XML, individual data records that cascade in a logical fashion can be flowed automatically into new pages.  Basically what you do is to create an XML based layout with the dynamic portion you wish to flow in a single frame, apply paragraph styles to the different tags appropriately and then after deleting unused records, reimport the XML with some specific boxes checked (depending on how you wish to proceed).
    From there simply dragging the data root into the frame will cause overset text as it imports all the XML information into the frame.  Assuming that everything is cascaded correctly using auto-flow will cause new pages to be automatically generated with the tags correctly placed in a similar fashion to datamerge -- but far more powerful and flexible. 
    The issue then again comes down to data organization in the XML file.  In order to use this method the data must be organized in the same order in which it will be displayed.  For example if I had a Lastname field, and a Firstname field in that order, I could not call the Firstname first without faulting the document using the flow method.  I could, however, still drag and drop content from each tag into the frame and it would populate correctly regardless of the order of appearance in the XML.
    Honestly either method would be fantastic for our current set of projects, however the flow method may be particularly useful in jobs that would require more than 40 spreads or simple layouts with huge amounts of data to be merged.

  • Due date is showing earlier than doc. date

    Hi,
    I have a funny question. I have posted billing doc. in VF01 for 10000/- on 30.06.2009 payment term is 30 days from the doc. date so the due date should be 30.07.2009. Against this doc. i have posted one residual payment for 5000/- on 15.08.2009 but when i am executing customer line item report in FBL5N system is showing this residual doc. date is 15.08.2009 and due date is 30.07.2009. Why is the due date showing a earlier date than doc date? The due date should be the same day or later than doc date.
    Adv. thanks to all....
    Regards

    Hi,
    When we do a residual payment option, the new document created for the residual amount, is created with reference to the original document. When we create documents with reference, by default the baseline date of the new document is same as that of the original. You can change the base line date by double clicking on the line after simulating.
    Also check if you find any options in SPRO under the open item processing in the business transaction node for Accounts receivable and Accounts payable.
    Thanks and Regards,
    Anit

  • Get purchase order doc date using BAPI function module

    Hi,
    I have a .net windows application that uses BAPI_PO_GETDETAIL function module to get particular details of a PO in SAP. But i am not able to get the "Doc Date" for a particular PO. I am able to get all the details of items from the table "PO_ITEMS ". I used only 1 input parameter "PURCHASEORDER".
    Please help me to get this thing done
    .netframework : 4.0
    Language: C#
    Visual Studio: vs 2010
    Regards,
    Manosh Jacob

    Absolutely hynek petrak..
    Manosh Jacob You can go with the above technique.

  • Difference between doc date,posting date and invoice date

    hi bw guys
    can someone give a brief on the difference between doc date,posting date and invoice date.and the invidual definitions
    thank you

    Hi,
    Posting Date: Date which is used when entering the document in Financial Accounting or Controlling. The posting date can differ from both the entry date and the doc date.
    Document Date: The document date is the date on which the original document was issued. Ex: Inv date, Bill date etc.,
    Invoice Date : Usually the date when goods are shipped. Payment dates are set relative to the invoice date.
    -Vikram

  • How can I generate a data merge that includes a barcode from excel spreadsheet to InDesign?

    Can you please advise if the following process is possible within InDesign CS 5.5? (Mac OS 10.8.2).
    We need to create a data merge that includes a barcode. The data merge is for several thousand records.
    We have a customer-supplied Excel spreadsheet that contains seven fields, one of which is a number that ultimately needs to print as a barcode when we make the data merge in InDesign.
    As you would expect, the conventional six fields data merge perfectly - but we can't find a way to make the barcode print correctly within the data merge.
    We have investigated several possible solutions without success.
    Some solutions suggest a plug-in for Excel to convert the number into a barcode whilst still in the spreadsheet - but this doesn't come across correctly when we import the CSV file into the InDesign data merge.
    We have investigated certain third party software applications but none provide the full solution we require. Some, for example, appear to create the barcode within the Excel spreadsheet but don't produce the barcode correctly when we data merge in InDesign; and some will allow us to create a one-off barcode within InDesign but have no automated way of retrieving the thousands of Excel numbers and turning them into barcodes.
    We have also come across possible 'font' solutions but have had no success with these either.
    For a previous job we needed to produce we outsourced to a specialist mailing company, who assured us they produced the whole job (very quickly) within InDesign. They, understandably, won't tell us how they did it. But, given the speed with which they produced the job for us, we imagine - with the correct software - the whole process is easy to do.
    Can you please advise?

    See second posting atHow do I generate a data merge in InDesign from an excel spreadsheet which includes a barcode

Maybe you are looking for

  • How can I watch a rented movie on apple tv on my pc?

    I rented a movie on apple tv and I want to see it on the pc, how do I make it? when accessing my itunes not the film is available to watch

  • How to get rid of a mail account?

    I had two .mac accounts and wanted to get rid of one and just use the other one. So I deleted everything in my Mail/Preferences so the only e-mail address is the one that I currentely would like to use. Now, when I look in: User/Library/Mail Folder I

  • Problem with cd player

    I am trying to play a cd on my toshiba satellite l305 (vista) but when I load the cd I hear it  but it won't play so  I then select the media center and select from the options but it still will not play.  What am I doing wrong?

  • Unwanted pause in preview

    I have a slide with several text boxes that appear in 2 second intervals. This is controlled via the timeline. When I preview the slide it runs ok and then stops prior to the first text box appearing. On some slides it works fine on others nothing. I

  • Weblogic Portal Exception causing user management issue in portal console

    Hi, We have weblogic 10.3 portal configured on Solaris environment. However after starting the servers, when we try to click a user in the user management console, the profile for that user will not come up. Below is the exception we are seeing in lo