Adding logic based on page number

Hi,
in my invoice report, i need to add some logic based on page number. My objective is to print a group of 4 lines (OMR Marks) on right hand side of the page. For example, on first page, print 1st line only, on second page, print 2nd line only, on third page, print 1st and 2nd lines only, on 15th page, print all four lines, on 16th page, print lines similar to 1st page i.e. print 1st line only, on 17th pages, print lines similar to 2nd page i.e. print 2nd line only.
Is there any way to use page number or some other variable that can represent page number in an IF condition? Your help is highly appreciated.
Regards,
sanjai misra

Thanks for your reply.
I need to print OMR marks in our invoice report and i am not sure how to do it. I will highly appreciate your inputs.
I have to print OMR mark a per the logic given below
1. Divide the page number by 15
2. Based on remainder value, print 4 horizontal lines. For example,
if remainder is 1 then print only line 1,
if remainder is 2 then print only line 2.
if remainder is 3 then print line 1 and line 2.
If remainder is 4 then print only line 3,
if remainder is 5 then print line 1 and line 3
if remainder is 6 then print line 2 and line 3
if remainder is 7 then print line 1, 2, 3
if remainder is 8 then print only line 4 and so on
if remainder is 0 then print all lines i.e. line 1,2,3 and 4.
Could you please tell me how I could achieve this? If you have some code that you could share, it would be great.
OR is there some other way to achieve this?
Thanks,
sanjai misra

Similar Messages

  • How to increment a value in a textfield based on page number

    Hi,
    I am doing PDF based print forms which is non interactive, i got a requirment where i have to increment the binded value of a text field based on page number.
    presently i am using this code in initialize event of that textfield.
    var curpage = $layout.page ( ref ( $ ) )
    var totpages = $layout.pageCount()
    $.rawValue = $.rawValue - totpages
    $.rawValue = $.rawValue + curpage
    but this is not helping me, can anyone help me regarding this

    Thanks for yor reply.please you can tellme clearly how to set use 'NQ_SESSION.USER' to set the value to logged in User.i.e i have circle table in that users and circle names will be there.it is teradata database.so how can i set that in to the dashboard prompt and one thing along with that prompt the follwing prompts will be there
    mobile no<>
    date<>
    circle name<"user">
    this is my requirement so please help me step by step what to do for achiving this.
    thanking oyu

  • Moving objects incrementally based on page number

    Hey all,
    Trying to automate a group of objects moving down a page, driven by the page location in a book.
    New to scripting, just need some pointers on best practise, gotchas etc.
    Any thoughts?

    Using a script doesn't make it 'live', the object will not be 'affected' after you move it once. But apart from that, it's pretty simple.
    Given a current page number n, a number of pages ntot, a page height h, and an object height oh, you can use this calculation for the top position:
    topy = n*(h – oh)/ntot
    You can change an object's y position by writing the value into its geometricBounds array:
    var myBounds = someFrame.geometricBounds;
    myBounds[2] = myBounds[2] - myBounds[0] + topy;
    myBounds[0] = topy;
    someFrame.geometricBounds = myBounds;
    As you can see, you have to read and write the array in one single piece. You need to change two elements: number [0] holds the top y position, number [2] holds the bottom y position. As you can see, you have to 'calculate' the bottom first, based on the top (A good alternative is using the move function but I can't write that from the top of my head.)

  • Modify width of rectangle based on page number in InDesign via Javascript

    I have a rectangle called `pageBar` on my master page !
    I would like to create a script that will automatically resize the width of the rectangle based on the page number.
    Something like : `width = 1280 * (pageNumber / pageTotal)`
    Any help would be much appreciated.
    Thanks in advance,
    J.

    Here's the script I ended up with. I'm a bit unhappy that I ended up having the literal string "pageBar" in it twice. The second instance is there to allow the script to be run on the same document twice -- that's one of the prices you pay for using master page items in a script rather than creating objects on the fly and applying an object style to them (better than setting selected properties):
    //DESCRIPTION: Size PageBar on each page
    (function() {
              if (app.documents.length > 0) {
                        sizePageBars(app.documents[0]);
              return;
    function sizePageBars(aDoc) {
              var pageBar = getMasterItem(aDoc, "pageBar");
              if (pageBar == null) return;
              // walk through the document's pages and deal with each page
              var theMaster = pageBar.parent;
              var numPages = aDoc.pages.length;
              for (var j = numPages - 1; j >= 0; j--) {
                        if (theMaster == aDoc.pages[j].appliedMaster) { // ignore pages with other masters
                                  processPage(aDoc.pages[j]);
              function processPage(page) {
                        // numPages, pageBar and j are visible as global variables in this function
                        // caculate desired width
                        var desiredHalfWidth = 1280 * (j + 1)/(numPages * 2); // j starts at zero;
                        // could be running script for a second time, so check to see if page already has pageBar on it
                        var bar = page.rectangles.item("pageBar");
                        if (bar == null) {
                                  var bar = pageBar.override(page);
                        var pBounds = bar.geometricBounds;
                        var xCenter = (pBounds[3] + pBounds[1])/2;
                        pBounds[1] = xCenter - desiredHalfWidth;
                        pBounds[3] = xCenter + desiredHalfWidth;
                        bar.geometricBounds = pBounds;
              function getMasterItem(aDoc, name) {
                        var appliedMaster = aDoc.pages[0].appliedMaster;
                        var anItem = appliedMaster.rectangles.item(name);
                        if (anItem == null) {
                                  alert("Couldn't locate 'pageBar' rectangle.");
                        return anItem;
    I was going to introduce to the resize method, but that would have first meant understanding it myself. The description in the object model viewer is a masterful demonstration of how not to communicate complicated information.
    So I did a web search and found myself on this page by Marc Autret: http://www.indiscripts.com/post/2013/05/indesign-scripting-forum-roundup-4
    Search that page for resize and you'll see what I mean. Compared to the simple manipulation of geometric bounds, using resize is a nightmare of complexity. Marc has simplified it by providing a function you can call, but I decided to just go with using the bounds.
    I hope this proves helpful to you.
    Dave

  • Conditional formatting based on page number that resets on repeating frame

    Hello everyone,
    I have searched through multiple forums on multiple sites and haven't come across anyone who has accomplished this.
    I have a report with pages numbers that reset on a repeating frame.
    I have a text boiler plate that I want to only show up on page 1. On every occurrence of page 1.
    SRW.GET_PAGE_NUM does not work because it returns physical page number.
    I'm trying to access the value of the field for my page number. The value comes from "source" drop down with value of "Page Number".
    I've tried accessing the <&page number> in the PL/SQL of my conditional formatting trigger but no luck.
    This report is 14K plus pages so I'd rather not be inserting and selecting the value back out of the database.
    Does anyone have any ideas??
    Thanks,
    Alan

    To avoid inserting/selecting from the database
    Maybe you could create a small package on the database to store page numbering information.
    Then use get/set routines per your requirements.
    CREATE OR REPLACE PACKAGE rep_page_no IS
       gPageNo NUMBER;
       PROCEDURE set_it(pPage NUMBER);
       FUNCTION get_it RETURN NUMBER;
    END rep_page_no;
    CREATE OR REPLACE PACKAGE BODY rep_page_no IS
       PROCEDURE set_it(pPage NUMBER) IS
       BEGIN
          gPageNo := pPage;
       END set_it;
       FUNCTION get_it RETURN NUMBER
       IS
       BEGIN
          RETURN(gPageNo);
       END get_it;
    END rep_page_no;Then in your repeating frame you could access this package rather than insert/select from any database table.
    Let me know if this works, I might like to try it.
    Thanks

  • Dynamic text based on page number

    Hi Everyone,
    I'm trying to place a dynamic text on an hrform. The form is displaying wage types and when there are more than 2 pages, the values on the first page need to be summerized into a variable with the text subtotal in front of it. When we are on the last page, the text total with the total of all the wagetypes needs to be displayed. I tried to use the sfsy-page and sfsy-formpages variables to know on which page i am but the strange thing is that when i use in in program lines and i use debugger to look into the variable i get this:
    First page:
    sfsy-page = 1
    sfsy-formpages = 1
    Second page:
    sfsy-page = 2
    sfsy-formpages = 2
    But when i place it into a text element to test i get 1 of 2 on page one and 2 of 2 on page two. How is this possible?
    Also i want to display a subtotal of the displayed wagetypes per page. Anyone an idea how i can do that?
    Thank you!
    Lars

    Hi,
    The reason you get 1-1 ,2-2 in debugging is because, the pages are added dynamically,depending on the length of your main window.Which doesnt get captured initially,but can be used in text element.
    As far as totalling on every page and at the last page is concerned ,try teh following link:
    link: [http://wiki.sdn.sap.com/wiki/display/ABAP/Togetsubtotalsoneachpagein+smartforms]

  • Need help printing pagefooter conditionally based on page number

    In the layout I'm working on, there is a <?call:footer?> in footer section. I want to avoid call it for certain pages. Eg. not print it on the first page.
    Is there a page-variable available that can be used to conditionally test and print this? (in example below find something replacing "currentpagevariable")
    Eg. <?if:currentpagevariable!='1'?><?call:footer?><?end if?>
    Note, I've tried to use the "Different first page" option, but due to reports complexity in report header, cannot use this option.
    Any suggestions as soon as possible would be much appreciated.
    /Thanks, Dan

    this is not possible.

  • How to use page-number in xsl:if

    Hi
    I would like to use <fo:page-number/> in my if clause. Based on page number, I would like to add some more fields.
    If help on this greatly appriciated.
    Thanks,
    Ram.

    i'd like to check page num, if page num > 1 then output current page of total pages. if it's possible, plz tell me how?
    because i used check row num to do this, its not right method.

  • Not able to reset the page number in XML Publisher based on each PO

    Not able to reset the page number in XML Publisher based on PO
    Hi,
    I have created a custom purchase report and rtf template. In the rtf template, I have added the page number feature (i.e. Page 1 of 5) from Word in the template. When I run the report for a range of POs, I expect the results as follows:
    I have given 3 POs on single request. (PO#1 has 3 pages, PO#2 has 2 pages and PO#3 has 4 pages), the page number on each PO should look like as follows:
    PO#1 page 1 of 3, page 2 of 3, page 3 of 3
    PO#2 page 1 of 2 page 2 of 2
    PO#3 page 1 of 4, page 2 of 4, page 3 of 4 and page 4 of 4
    But the page number displays on each PO as follows:
    PO#1 page 1 of 9, page 2 of 9, page 3 of 9
    PO#2 page 4 of 9 page 5 of 9
    PO#3 page 6 of 9, page 7 of 9, page 8 of 9 and page 9 of 9
    Here I have to reset the page number based on each PO. If anyone done this already, can you please share with me.
    Thanks,
    Ram.

    Hi
    One clarification please.
    Are you putting Page # of ## in the for-loop section? I mean it should be within For-each@section block.
    Even if this doesn;t work, then try using Insert->Page Break after every PO.
    Regards
    Varun

  • Hiding Image field based on the page number in Adobe Form- Script

    Hi Folks,
    I have a problem with the print form that I am working on. I need to insert an image of lines (OMR) based on the page numbers. For the OMR part, the first page will always have 4 lines as a image, the middle pages will have 3 lines as a image and the last page will have two lines as a image.
    I have uploaded these 3 images a BMPs in SE78 and I am using Xstring of these images in the form. I have two master pages. First master page is for the first page and the second master page is for the remaining pages. The first master page will always have the 4 line image. I created a positioned subform in the master page2, in that subform, I have 2 hidden numeric fields, as the run time properties one for the current page number, other one for the total number of pages. I placed those two images(one for the three line image and the other one for the two line image) exactly on the same location positioned dimensions wise. 
    I have written the java script for these two image fields to show based on the page numbering. But, somehow, it is not working. Can anybody please let me know where I am doing wrong. I am posting my java script here.
    for the three line image:
    var cp = data.PageSet.MasterPage2.OMR.cpage.rawValue;
    var np = data.PageSet.MasterPage2.OMR.npages.rawValue;
    //if(data.#pageSet[0].MasterPage2.OMR.cpage.rawvalue == data.#pageSet[0].MasterPage2.OMR.npages.rawvalue){
    for (j=0; j<xfa.layout.pageCount(); j++){
      if(cp == np){
        xfa.resolveNode("data.PageSet.MasterPage2[" + j + "]").OMR.OMR2.presence = "hidden";
      else{
        xfa.resolveNode("data.pageSet.MasterPage2[" + j + "]").OMR.OMR2.presence = "visible";
    For the two line image:
    var cp = data.PageSet.MasterPage2.OMR.cpage.rawValue;
    var np = data.PageSet.MasterPage2.OMR.npages.rawValue;
    for (j=0; j<xfa.layout.pageCount(); j++){
      if(cp == np){
        xfa.resolveNode("data.PageSet.MasterPage2[" + j + "]").OMR.OMR3.presence = "hidden";
      else{
        xfa.resolveNode("data.pageSet.MasterPage2[" + j + "]").OMR.OMR3.presence = "visible";
    Please give me a direction as this is kind of hurry.
    Thanks,
    Srinivas.
    Edited by: srinivas kari on Jun 9, 2010 2:03 AM

    HI Otto,
    Thanks for the response. You are right, I am struck with this image. My problem was to keep the OMR marking on each page based on the page number. It is like a lines with 10mmX10mm dimension at the top right corner for the sorter machine to know the number of pages to put in the envelope. The logic for this is, on the first page, it has 4 lines each 3mm apart. On the middle pages it has 3 lines . On the last page it has 2 lines. When the sorter machine picks these, it looks at the first page with 4 lines, it will count as a first page, it will continue through the 3 line pages as the middle pages until it reaches the 2 line to know it as the last page. This is all happens in the master pages. I have two master pages , one for the first page and the second one for the remaining pages.
    At first I did not know how to To achieve this, I created 3 images. one with 4 lines, another ones with 3 lines and 2 lines. The 4 lines image was on the first master page. The 3 lines and 2 lines images were on the second master page at the same place as the image fields positioned. Thats where I was trying this scripting. I was trying to capture the current page and number of pages. Based on these, I was trying to place them.
    Is there any other way to achieve this instead of using the images? I thought of sy-uline. but some in the forum told that its not going to work. Even if I use the sy-uline, I have to do some script to achieve this I believe.
    Any inputs on this.. Please give the direction.
    Thanks,
    Srinivas.

  • Hiding Image filed based on the page number in Adobe Forms - scripting

    Hi Folks,
    I have a problem with the print form that I am working on. I need to insert an image of lines (OMR) based on the page numbers. For the OMR part, the first page will always have 4 lines as a image, the middle pages will have 3 lines as a image and the last page will have two lines as a image.
    I have uploaded these 3 images a BMPs in SE78 and I am using Xstring of these images in the form. I have two master pages. The first master page will always have the 4 line image. I created a positioned subform in the master page2, in that subform, I have 2 hidden numeric fields, as the run time properties one for the current page number, other one for the total number of pages. I placed those two images(one for the three line image and the other one for the two line image) exactly on the same location positioned dimensions wise.
    I have written the java script for these two image fields to show based on the page numbering. But, somehow, it is not working. Can anybody please let me know where I am doing wrong. I am posting my java script here.
    for the three line image:
    var cp = data.PageSet.MasterPage2.OMR.cpage.rawValue;
    var np = data.PageSet.MasterPage2.OMR.npages.rawValue;
    //if(data.#pageSet[0].MasterPage2.OMR.cpage.rawvalue == data.#pageSet[0].MasterPage2.OMR.npages.rawvalue){
    for (j=0; j<xfa.layout.pageCount(); j++){
    if(cp == np){
    xfa.resolveNode("data.PageSet.MasterPage2 [" + j + "]").OMR.OMR2.presence = "hidden";
    else{
    xfa.resolveNode("data.pageSet.MasterPage2 [" + j + "]").OMR.OMR2.presence = "visible";
    For the two line image:
    var cp = data.PageSet.MasterPage2.OMR.cpage.rawValue;
    var np = data.PageSet.MasterPage2.OMR.npages.rawValue;
    for (j=0; j<xfa.layout.pageCount(); j++){
    if(cp == np){
    xfa.resolveNode("data.PageSet.MasterPage2 [" + j + "]").OMR.OMR3.presence = "hidden"; // there is some problem while //posting it is like MasterPage2[" + j + "]")
    else{
    xfa.resolveNode("data.pageSet.MasterPage2 [" + j + "]").OMR.OMR3.presence = "visible";
    Please give me a direction as this is kind of hurry.
    Thanks,
    Srinivas.
    Edited by: srinivas kari on Jun 9, 2010 12:04 AM

    HI Otto,
    Thanks for the response. You are right, I am struck with this image. My problem was to keep the OMR marking on each page based on the page number. It is like a lines with 10mmX10mm dimension at the top right corner for the sorter machine to know the number of pages to put in the envelope. The logic for this is, on the first page, it has 4 lines each 3mm apart. On the middle pages it has 3 lines . On the last page it has 2 lines. When the sorter machine picks these, it looks at the first page with 4 lines, it will count as a first page, it will continue through the 3 line pages as the middle pages until it reaches the 2 line to know it as the last page. This is all happens in the master pages. I have two master pages , one for the first page and the second one for the remaining pages.
    At first I did not know how to To achieve this, I created 3 images. one with 4 lines, another ones with 3 lines and 2 lines. The 4 lines image was on the first master page. The 3 lines and 2 lines images were on the second master page at the same place as the image fields positioned. Thats where I was trying this scripting. I was trying to capture the current page and number of pages. Based on these, I was trying to place them.
    Is there any other way to achieve this instead of using the images? I thought of sy-uline. but some in the forum told that its not going to work. Even if I use the sy-uline, I have to do some script to achieve this I believe.
    Any inputs on this.. Please give the direction.
    Thanks,
    Srinivas.

  • How to print logical page number in TOC of report

    My report has three sections - header, main, trailer.
    after each group break in the main section the page number is saved using the srw.get_page_num(pageNum).
    this records are used to build the toc in the trailer section.
    Problem: srw.get_page_num delivers only the logical pagenum of the section,
    means if the header section spans more than one page (for example 2), the main section starts at physical pagenum 3.
    If I don't know how many pages my header contains I never have the real page number in my toc, beacuse i have to add the number of "header pages" to the saved pagenum of the main section to compute the "physical pagenum".
    Is there a possibility to save the physical pagenum in the header section (in a trigger) ?
    Message was edited by:
    [email protected]

    Thats my huge problem - i can not calculate the number of pages
    nor in the main section neither in the header section.
    The problem is not to know how many pages are in the trailor section.
    I have to know, how many pages are in the header section without to start multiple the report.
    If I have this number i can add it to the "logical" page number" of the main section to get the physical page number of the report.
    the page numbers of the main section are available.
    Message was edited by:
    [email protected]

  • Adding list based menu only once for all related pages

    Hi,
    I have a one level tab application. For a given tab I have 5 different pages. I would like let the end user navigate to these pages via a list region. Currently I have added to all five pages a list region and assigned the same list item to these list regions.
    Is it possible that I add this list based menu only once to my application or this is the normal way of doing it?
    Is there a way to let
    Regards,
    Tamas

    Use page zero.
    Add regions containing the lists for each tab to the same region display point on page zero, making each region conditional using a "Current Page Is Contained Within Expression 1..." condition.

  • Adding Page Number in PDF using VBA

    Hi,
    I need to add page numbers to around 8000 PDF files via excel VBA. I would need to do this every month. I am new to VBA coding but I can manage to write a decent code. It would be great if any one of you would share a VBA code that would allow me to add page numbers to PDF files. I have Adobe professional 6.0.
    This is kind URGENT. All help will be welcome !!!
    Thanks

    Hi Vivek,
    Could you please test the following solutions to resolve the issue.
    Solution1:
    To display the page numbers from the first according to the section details i.e based on the number of sections in a report.
    example: If a report has3 sctions and first section comes in 3 pages,2nd section comes in 4 pages and 3rd section in 2 pages, then total number of pages is9. Then the display of page numbers should be [page number of section in(1,2or3)/total number of pages in all the sections]
      Insert a cell within a page and insert the formula
    =Concatenation("Page"" " ,PageInSection(1)" ")
    If the above doesnu2019t works then please try the following solution.
    Solution2:
    --Create a report with section.
    --Format the Section to "Start on a new page"
    --Apply Page Layout to the report
    --Insert a Cell and apply function  PageInSection()
    I hope this will help you.
    Regards,
    Deepti Bajpai

  • AR Customer statements report Page numbers Reset based on customer number

    Hello,
    In the AR Customer statements report, If I ran the report for multiple customers, page number has to be reset for each customer...
    Group Started like below,
    <?for-each-group:G_STATEMENT;STATEMENT_DATE?><?for-each-group:current-group();SEND_TO_ADDRESS_ID?>

    Hi Kittu,
    I got the answer using @section command.
    Below are the complete syntax in my case.
    Form field         --Xml Tag
    If Data Found --<?choose@section:?><?when:count(G_SETUP)!=0?>
    Group G_SETUP  --<?for-each@section:G_SETUP?>
    Group G_STATEMENT --<?for-each-group@section:G_STATEMENT;STATEMENT_DATE?><?for-each-group@section:current-group();SEND_TO_ADDRESS_ID?>
    Its working for me.
    Let me know if you required more information.
    Regards,
    Dasarath

Maybe you are looking for

  • Can't save pdf in cs5 on mac, why?

    Anyone?

  • HTTPService call not working

    I am not able to call the url for some reason. When i click on submit it says in the browser status bar 'Waiting for localhost...'. The swf file is located at 'http://localhost:8080/web/main.swf' so its on the same domain. Heres the code. <?xml versi

  • ITunes not updating podcasts?!?!

    So now it's up to itunes to decide when and when not to updat a podcast? I am very very busy lately and, just haven't connected it to my pc to update (this particular podcast is a subscription based podcast and doesn't auto update.on the ipod) for ab

  • My Verizon account website will not open

    does not let me add text to my verizon website. This adding text feature works well on internet explorer. I can click on add text, the box opens up but I can not type in the box for some unknown reason. What can be done to correct this problem ...

  • Where to find a password which i have forgot

    Hi all , I forgot the pw to enter into sqlplus . Please let me know how can i find it.