Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

odd and even numbers

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    odd and even numbers

    I am printing reports that have various page lenghts.
    I want to insert a page brak after each report that
    had odd number of pages, i.e. after 1,3,5,7,9... pages I insert a blank page after 2,4,6,8... I don't.

    While I know how to insert a page break, and how to count page numbers, I don't know how to write a function that will insert the page break only if the page number is odd.

    Any suggestions?

    #2
    RE: odd and even numbers

    Take a look at the mod() function.
    There can be only one.

    Comment


      #3
      RE: odd and even numbers

      Mod() Returns the Remainder of the Numerator divided by the Denominator.

      That is not at all appropriate. Any other suggestions?

      Comment


        #4
        RE: odd and even numbers

        Jack, if you divide the current page number by 2, the MOD() of the result will either be zero or 1. Perhaps this is what Stan had in mind, since this is a way to determine whether a particular page number is odd or even.

        -- tom

        Comment


          #5
          RE: odd and even numbers

          Perhaps something like this:

          if(mod(pageno() / 2) = 1,,)

          Comment


            #6
            RE: odd and even numbers

            Hi all,

            I have used the mod syntax to control various text elements but I would like to know if anyone has successfully created a conditional page break regardless of how the condition is generated.

            The closest I have come to controlling pagination is via grouping levels and subreports.

            Thanks,
            Bill
            Bill Hanigsberg

            Comment


              #7
              RE: odd and even numbers

              Can you explain a little more about what you want to accomplish. I'm not sure I understand what you mean by inserting a page break "after" a report.

              Do you want to eject the next page after a report finishes which had an odd number of pages? Do you want to insert a page break "in" the report based on the number of pages printed for the current group (if it was odd number)?

              I'm just not seeing the situation clearly.
              There can be only one.

              Comment


                #8
                RE: odd and even numbers

                Just verified that a calculated field, placed in the page footer, defined as:

                if(mod(pageno(),2)=1,str(pageno()),"")

                will print the page number only on odd numbered pages. This isn't what was asked for but is a marker toward what we want. Does any one understand the part about inserting a page break after the report?
                There can be only one.

                Comment


                  #9
                  RE: odd and even numbers

                  Basically I am printing a double sided report (I am printing on both sides of the page) and I want each new report to start on a new page instead on the back of a page that belongs to another report.

                  If the report has even number of pages, e.g. 2,4,6 it's no problem. The 2 paged report fits on the front& back of 1 page, the 4 paged report fits on 2 pages, etc...

                  At the end of each report I issue a page feed (a5 page break) and each new report starts on the front of a new page.

                  If however, the report is 3 pages long, the next report might start on the back of page 2 since the printer is configured for doublesided printing and it will interpret the page break command as starting to print on another side of the page instead of doing a real page feed.

                  To avoid this, I want to issue a conditional command to have 2 page feeds after an odd numbered report. The regula page feed and an additional one to eject the page and start on a new page.

                  Thanks for everybodys help in this matter.

                  Jack.


                  to both sides of the page

                  Comment


                    #10
                    RE: odd and even numbers

                    Until some one weighs in on this, I just experimented with creating a "blank page" report, actually contained a "period" in the report header, no detail section, etc.....

                    You should be able to "print" such a report from the onprintexit event based on the formula given earlier to decide if the pageno() is even or odd.

                    That make any sense? Does seem quite a kludge.
                    There can be only one.

                    Comment


                      #11
                      RE: odd and even numbers

                      Hi Gents,

                      This issue interests me as well. It arises in the case of a single report such as an address list where you want to print double sided and separate groups with tabbed dividers. In this case as well, you want new groups to begin on the right hand (recto) page.

                      As I see it, the problem breaks into two parts.
                      -create the condition
                      -make a conditional page break.

                      The first turns out to be easy; just use the system variable which holds the page number; very convenient. If the page on which a group finishes has an odd page number, you need to insert a blank page to have the next group begin on the recto side.

                      However, so far I have been unable to produce a conditional page break.

                      I hope someone has a moment of inspiration. So far, I haven't.

                      Bill
                      Bill Hanigsberg

                      Comment


                        #12
                        RE: odd and even numbers

                        If I understand your problem, you are trying to print a series of reports
                        starting each report on the front page so to speak.
                        Why not define a "blank" report. I am not very adept in Xbasic, but
                        from following this board I would be surprised if someone can translate
                        the following very crude pseudocode to Xbasic.:

                        print the first report
                        if the last page is odd, print the blank report
                        print the second report
                        if the last page is odd, print the blank page
                        etc,

                        The mod function would be needed to test if the last page is odd
                        numbered.

                        This Xbasic script would need to be written once if the reports
                        are always the same. That is the same reports need to be printed
                        every time.

                        I assume that when a new report is to be printed, its page numbers
                        would start with or reset to 1.

                        This is just a thought and perhaps might generate a solution by one of
                        the experts.

                        Comment


                          #13
                          RE: odd and even numbers

                          Investigation reveals that, at the time the onprintexit event fires, the pageno() has been reset to zero. Therefore the previous suggestion will not work.

                          Other avenues explored include:

                          placing a large conditional object in the report footer with a "period" at the bottom and the mod condition. - No help

                          placing a conditional object in the footer, a rich text field in the conditional object, and a page break in the rich text object. - No help

                          Sorry
                          There can be only one.

                          Comment


                            #14
                            RE: odd and even numbers

                            Hi all,

                            Well folks, it *can* be done. Recto-verso pagination can be controlled--within limits.

                            Why should we care? When we print to one side only it doesn't matter. However, printing duplex, if we have a report with multiple sections (grouping levels) and we want to separate the sections with tabbed dividers then when a new section (group) begins on the reverse side of the page, then it will come before rather than after the tab.

                            A simple example would be an address book. Lots of the time these books have tabs which combine letters: AB; CD; EF; GH.... You don't want "A", "C", "E", "G" etc. to start on the reverse (verso) side of the page. I won't detail the process by which I was able to force a new group every second letter. The group is called "Tab".

                            Luckily the verso sides have even page numbers and the report generator has a system variable which holds the page number. In other words, generating the condition is no problem. (We all knew this already.) Use the mod function with a denominator of 2. Recto gives a mod of 1. Verso yields 0.

                            Previous contributions have established what *doesn't* work and I won't reiterate all that except to recall that the obvious method--a page break on a condional object is a no go.

                            It would be great if a page break object accepted a conditional expression but it doesn't. However, the break's property sheet has a "break optionally" checkbox. Look in the manual and you'll find that it is intended to keep memo fields from being split by a page break. If the field is too big to fit it is shifted to the next page. This sparse documentation meant I had to do a bit of experimentation.

                            Here is what to do:
                            -In group properties, on the region tab, make sure "start group on a new page" is checked.
                            -Create a group footer. In its properties, check "allow shrink" and "keep together on a page."
                            -Insert a page break object at the very top of the footer. Open its properties and check "optionally break."
                            -Insert a conditional object right after the break. In its properties be sure to check "allow shrink."
                            -Using the mod function create two conditions, even and odd. Leave the layer for the odd condition blank.
                            -Put a couple of text objects on the "even" layer of the conditional object. Place one at the top and one at the bottom to prevent the conditional object from contracting at print time. The contents of the text doesn't matter; it will never print.
                            -The required size of the conditional object depends on your page length. It must be big enough to not fit on a page with anything else but must not take more that a page by itself.

                            Here is what happens:
                            -If a group finishes on the reverse side, the page condition is "odd" so the group footer is empty, and it shrinks, so there is nothing to print. The next group starts on the next page which is recto so you're fine.
                            -If a group finishes on the recto page, the "even" condition is true, the footer is too big to fit, the conditional page break kicks in and the conditional object moves to the next page. But now the page number is odd so what "prints" on that page is the "odd" or empty layer of the conditional object. (This was a happy surprise!) My report has the page number in the page footer section and this confirms what is happening.

                            I hope this is useful to someone else because it took a hell of a long time to discover.

                            All the best,
                            Bill
                            Bill Hanigsberg

                            Comment


                              #15
                              RE: odd and even numbers

                              I don't care what everyone else says, you're pretty smart. Persistence pays off again.

                              Have a good weekend.
                              There can be only one.

                              Comment

                              Working...
                              X