Inserting blank page for ads according to datamerged field.checking for whether a variable exists on

Let me see if I can explain what I am trying to do. I have a script which loops through pages of an indesign document. I use a for loop to do so.
Within each page is a text frame called "Advertising" with a Y or N as the value. If the value is Y, I want to insert a blank page before the page with the advertising field. Within the for loop however, there are calls to other data fields. My issue is that when I add a blank page, and the for loop continues, it errs out because the blank page does not contain the variable fields I am using. (highlights)...
So my question is, how can I cause the for loop to skip the newly inserted page so that the missing variable doesn't cause the script to fail?
should I be checking whether the layer exists then doing something like:
if(newDoc.pages.item(i).pageItems.item("CompanyHighlights").length > 0){}
for(var i = o; i < PageLength-1; i++){
//some kind of check to determine whether it's a blank page, or a page with the variable.
     if(newDoc.pages.item(i).pageItems.item("CompanyHighlights").length > 0){
          var highlights= newDoc.pages.item(i).pageItems.item("CompanyHighlights").contents;
          var advertising = newDoc.pages.item(i).pageItems.item("Advertising").contents;
          if(advertising == "Y")
               //add blank page before this page

Thanks Hans, I actually got it working last night: I had to run a double if statement to check the Master page and move the counter var to a global var, and then add 1 to the counter "i" since I was adding a page, and add 1 to the PageLength so the for loop can continue on the pages that were moved ahead a page number by adding a page...not the best solution, but it works and I'm on a deadline. Thank you for trying to help though.
//make i a global variable
var i = 0;
for(i = 0; i < PageLength-1; i++){
//define master page of current page in the loop
var masterpage = newDoc.pages.item(i).appliedMaster.name;
//if its C-Master, skip it
    if(masterpage  != "C-Master"){
       //if it contains the merged Advertising field add a page
      var advertising = newDoc.pages.item(i).textFrames.item("Advertising").contents;
          if(advertising == "Y")
               //Add a page.
               newDoc.pages.add(LocationOptions.before, newDoc.pages.item(i) );
               newDoc.pages.item(i).appliedMaster =app.activeDocument.masterSpreads.item("C-Master");
               i=i+1;
               PageLength = PageLength+1;
var masterpageAgain = newDoc.pages.item(i).appliedMaster.name;
            if(masterpageAgain  != "C-Master"){
               var highlights=newDoc.pages.item(i).textFrames.item("CompanyHighlights").contents;

Similar Messages

  • I'm in a multi-page document, how can i rearrange the pages or insert blank pages in front of pages? Also, is there a way to show the ruler both horizontally and vertically?

    I'm in a multi-page Pages document, how can i rearrange the pages or insert blank pages in front of pages? Also, is there a way to show the ruler both horizontally and vertically?

    Not on my document. I have a 7 page document open. The "flashing vertical bar" is at the top of page 3. I have the thumbnail view showing. I click page break and two blank pages are added to the end of my document. I have to scrool thru the pages to see that the 2 pages were added as they do not appear in the layout view... I'm not sure if it is inserting a "section" as it adds two blank pages.. But I am clicking on "INSERT PAGE BREAK".. So guess there are still a lot of bugs to fix..
    Thanks again

  • Hi. I am not able to update the Adobe Flash Player on my MackBook Pro. The problem I am getting is a blank page for Step3. Can someone help please?

    Hi. I am not able to update the Adobe Flash Player on my MackBook Pro. The problem I am getting is a blank page for Step3. Can someone help please?

    If you already have an older version of Flash Player, open the Preference pane and select Check Now... under the Update portion under the General tab:
    You shouldn't have to install a new version from the website (I'm not even sure if you can) if you've already installed Flash Player.
    Clinton

  • Indesign CS5 crashing when inserting blank pages

    I wonder if anyone else is having this following problem with Indesign CS5?
    The program frequently crashes when inserting blank pages, especially several. I've noticed that this problem has something to do with amount of colums in the masterpage.
    Recently I had this problem when layouting a book with 9 colums per page. After converting them to guides the problem dissapeared. When using multiple column masterpages it's usually ok to insert 2 new pages a time. More than this the program crashes.
    Do I have to install the program again?

    Have you patched to 7.0.4?

  • Blank pages for all applications in Manager Self Service (MSS) role

    Hi Experts,
                       We are newly implementing ESS/MSS and deployed ESS/MSS business packages with following BP's
    BP ERP05 COMMON PARTS 1.51 SP5
    BPERPESSWDA 1.50 SP5
    BP ERP05 MSS 1.51 SP5
    after deploying above BP's all ESS applications working fine, but in MSS role all applications(Team,Budget, Projects and Planning) giving me blank page.
    for example..MSS>TeamEmployee Information--> when I click on "General Information,compensation Information links etc.." it is displaying in separate window with blank page. it is not displaying any error, just displaying blank page.
    We are using Net Weaver7.3, EHP5 and ECC6. Can any one help out of this?
    Thanks in advance,
    Janardhan

    There are two parts of the Web Dynpro based business package
    1. Portal content (iView Page, Role etc) (Starts with BPxxx.sca)
    2. Web Dynpro content(MSSxxx.sca)
    My guess is you have just deployed the Business package content and not the Web Dynpro content.
    Refer to this and deploy the corresponding files
    http://wiki.sdn.sap.com/wiki/display/ERPHCM/HOWTOGETRIDOFSPSTACKMISMATCHISSUES
    Thanks
    Prashant

  • Inserting blank pages on Adobe Reader for Android

    I'm a student and I use the Adobe Reader app for all my note-taking in lectures. If the lecture slides aren't released as .pdfs, I convert them before I go to my lecture because the Adobe Reader for Android app is so good for notetaking.
    However, economics is full of graphs, and I have to draw these on my lecture pad because there's rarely enough space on the slide pdfs. Is it possible to insert empty pages on Adobe Reader for Android? If not, are there plans to make this a feature? I think it would make Adobe Reader for Android the only notetaking app students need.

    Generally I just save the file as PDF in Powerpoint, but if I don't have access to a computer, I use the app PowerPoint2PDF on my Nexus 7.
    iAnnotate has the ability to create blank pages when taking notes on a PDF, but it's much clunker than Adobe Reader on Android.

  • "insert" "section" causes unwanted blank page for numbering

    I have a section/page numbering problem.
    I want to start page numbering on the 5th page (Chapter One). But.. when I insert a Section Break between the end of the TOC and first Chapter (where I want re-numbering to start) it causes a blank page to be inserted after the TOC and before the section break...
    How do I insert a section break between TOC and Heading that's set to "start new page" without getting blank page?

    Thanks I've got your file and have fixed it. It had to do with the way you constructed it.
    This is how to do what I did after I deleted your existing T.O.C.:
    1 click at foot of Title page > Menu > Insert > Section Break
    2 Type "Table of Contents" return > Menu > Insert > Table of Contents
    3 Menu > Insert > Section Break
    If there is a return at the beginning of the Introduction page just delete it.
    I also tidied up your layout a bit and have emailed it back.
    Peter

  • Insert blank page 2 for all documents in PDF.  Multiple document PDF.

    I have a form that prints on to many invoices. The first page contains a tear off stub, so i need to skip the second page for each invoice in a multiple invoice PDF.  Assuming this must be done with script as I can skip the page two of entire document but not individual invoices.

    I do not follow. Can you explain this further?

  • How to insert blank page into pages document when using word processing mode?

    I've recently created a 50+ page document using Pages '09. I started the document using word processing mode. Now, when I view in thumbnail mode and try to insert a blank page somehwere in the middle of the document, it won't allow me to select where I want. It just selects all the pages, as thought they are one section. I believe this is because I am in word processing mode. My question is, can I convert the document to layout mode so that each page represents it's own section, without losing what work I've already done? And if so, how?
    The document is entirely text boxes and images, so I don't have any need for word processing space. I just need new pages to act as blank templates for the text boxes and images I create.
    Is it possible to keep all my work as is, and convert the document to layout mode vs. word processing mode?
    Thanks!

    It just selects all the pages, as thought they are one section.
    That's because they are one section. You must insert section breaks to separate them. There is no need to use page layout which does make each page a separate section. You have to manually add each page & use text boxes or other containers for the text & link the text boxes.

  • Insert blank page into report after odd page

    I'm trying to get my report to insert a blank page at the end of each invoice if the invoice is an odd number of pages. We're looking to start printing two-sided invoices and need each invoice to be able to be mailed to the customer. I already have New Page after on the report footer and that works, but if I have a 3 page invoice, I need it to have a blank page as page 4 (without a page number). Page numbers are also being reset for each invoice if that matters. This is using Crystal Reports 10.

    Hi
    You can try the below:
    - Open section expert.
    - Select the section after which you need a new page.
    - Click on Paging Tab.
    - Put the below formula in X-2 for New page after:
    PageNumber mod 2 =0;
    - Save and close the formula editor.
    - Click on Ok.
    You can also apply some suppresion condition as per requirement.
    Hope this helps!!
    Regards
    Sourashree

  • Inserting blank pages into an existing document

    I'm new to Pages. I'm creating my first document, which involves text and photos. It's presently a 5 page document. I'd like to insert two new blank pages right after existing page 3 (for items that I don't have yet but will in the next day or so), but I can't figure out how to do that without messing up what I've done. "Insert page break" isn't showing up as an option when I put the cursor at the end of page 3 (which is on a photograph, immediately following a caption that's typed on the photograph). Also, I don't have any section breaks in the document.
    Any ideas? It seems like this should be something straightforward. Any guidance is appreciated. Thanks.

    chris,
    Click on View > Show Invisibles. You should see a paragraph marker at the end of page 3. Put your cursor right before that, then you should be able to click on Insert > Page Break. Do it twice and you should have two blank pages.
    -Dennis

  • Auto insert blank pages in a document and not count as page number.

    This might be too much to ask of the program but it would make my life easier. I have several documents with sub-sections. I print the final document and insert tabs between sub-sections. If a sub-section ends with the last page as the front side of the paper I must put in a blank page as I cannot put a tab page between sub-section 1 and sub-section 2 if sub-section 1 ends on the front of one page and sub-section 2 starts on the back of that page.
    I've laid out bookmarks in my document and I would like to have a way to automatically have a blank page inserted after the last page before a new bookmark if that last page would be on the front side of the paper. Also, I can't have that blank page or pages contain page numbers. The program must skip those pages and move on to the next actual page.
    I could make each sub-section a seperate document but then I'd have about 50 documents to manage instead of 13 and controlling the page numbering would be a pain if I'd have to insert a new page in one sub-section I'd have to readjust page numbering in all the other documents in that section.
    Any ideas?
    Thanks.

    If i give a paragraph that is on an even page that style it doesn't like it. The text disappears.

  • Blank page for PDF Report

    I have a XML report with header and footer and repeatable details. When the number of the detail transactions just fit in one page, a blank page will be printed as the last page.
    In the first field pf the detail line I have the xml code as
    <?for-each:G_LINE?><?sort:ITEM_CODE;'ascending';data-type='text'?><?sort:LOT_NUMBER;'ascending';data-type='text'?>
    In the last field of the detail line
    <?end for-each?>
    Does anyone know how to suppress the blank page? Thanks in advance.
    Regards
    Lawrence

    Simple check :
    1) Check your rtf template, if that has extra carriage return after last code line.
    If your last code line is <?end for-each?> then check carriage return.
    2) If your RTF template has empty page.

  • Inserting blank page into template

    I am working in a template. I would like to insert a blank page into the middle of it and create my own thing and then continue with more pages from the template. How do I insert a blank page.

    micheley,
    I think the easiest and cleanest way is like this: click on View > Show Invisibles so that you can see all the hidden characters, then put your cursor in front of the last paragraph marker on the previous page. Click on Insert > Page Break. That will add a new, blank page inside your document.
    -Dennis

  • Inserting blank pages.

    Oh my!  Have been to the manual but since I am a Sr. Citizen, its information was a little (well, a lot) over my greying locks.  Want to add a blank page in a continuous text document (word processing) with photos thrown in from iphoto.  Not locked, so the text moves, but not the photos.
    There are 109 pages in this document so I am not able to add a blank page between Page 3 and 4, as the thumbnails are all outlined in yellow! Tried sections, but only a blank page appears and it always inserts at the bottom of document.  Need help from some real brains out there.  Make it simple!  Thanks.

    Hi Vicki,
    Click to place the insertion point immediately after the last text you want to appear on Page 3.
    Go Insert (menu) > Page Break. Repeat.
    You'll now have an empty page following page 3.
    At the bottom right corner of the document window, grab the shaded triangle (three diagonal lines) and drag right to open a grey space to the right of your document.
    Click in the grey space to exit Text mode.
    With the empty page showing on your screen:
    Go Insert > Choose...
    In the Choose dialogue, navigate to the file that is your picture, select it, then click Insert.
    Drag the photo into position, and resize it as desired, using the handles at the corners.
    If you want text to appear on this page, and to flow around the picture:
    Make sure that one of the Wrap options is selected, using the Wrap button in the Format bar.
    Click immediately before the text on what is now Page 5 to place the insertion point there.
    Press delete ONCE to delete the second page break you inserted earlier.
    The text will jump up to resume immediately after (or beside, depending on the Wrap option you chose) the photo.
    Regards,
    Barry

Maybe you are looking for

  • KM4M-V 7061 updated bios for wxvga lcd support

    the last bios available at msi site is v1.4, no wide screen support for the vga bios (VIA S3 Unichrome IGP). anyone here can help?

  • Why can't I drag and drop photo files to Yahoo attachments - I can in IE

    Files open and close Yahoo!

  • Security by buyer,catalog,category

    Hello All, We have a requirement where we have two main categories A and B and both have different buyers (X and Y). Now we want that the buyer can see and create PO's for the requsitions belonging to their category. That is Buyer X can see and creat

  • Open ParametersのcommentIDとは何ですか?

    Adobe Acrobat 7.0.9 Standard Windows 2000 PDFのOpen Parametersを調査しているのですが.「comment=commentID」の「commentID」とは何を設定すればいいのかわかりません. ご存知の方がいらっしゃれば.ご教示ください. サンプルでは http://example.org/doc.pdf#page=1&comment=452fde0e-fd22-457c-84aa-2cf5bed5a349 と.書かれているのでノートツール

  • Customizing FileSystemView & PathSeperator

    Hi, I'm customizing FileSystemView enabling browsing an FTP server with the JFileChooser. Since the OS on the server and the client may differ, I extended java.io.File with my on class FakeFile, because File keeps changing the Path Seperators to the