This discussion is archived
10 Replies Latest reply: Jan 16, 2013 12:18 PM by 984171 RSS

How to create more than 8 body region positions like #REGION_POSITION_ID#

984171 Newbie
Currently Being Moderated
Hi,

I'm working on a template in APEX 4.2.1 where I need more than 8 region positions to display some reports in.
Is there a way I can add more?

Thank you.
Tiberiu
  • 1. Re: How to create more than 8 body region positions like #REGION_POSITION_ID#
    fac586 Guru
    Currently Being Moderated
    981168 wrote:
    Hi,
    Welcome to the forum: please read the FAQ and forum sticky threads (if you haven't done so already), and update your forum profile with a real handle instead of "981168 ".

    When you have a problem you'll get a faster, more effective response by including as much relevant information as possible upfront. This should include:

    <li>Full APEX version
    <li>Full DB/version/edition/host OS
    <li>Web server architecture (EPG, OHS or APEX listener/host OS)
    <li>Browser(s) and version(s) used
    <li>Theme
    <li>Template(s)
    <li>Region/item type(s) (making particular distinction as to whether a "report" is a standard report, an interactive report, or in fact an "updateable report" (i.e. a tabular form)

    With APEX we're also fortunate to have a great resource in apex.oracle.com where we can reproduce and share problems. Reproducing things there is the best way to troubleshoot most issues, especially those relating to layout and visual formatting. If you expect a detailed answer then it's appropriate for you to take on a significant part of the effort by getting as far as possible with an example of the problem on apex.oracle.com before asking for assistance with specific issues, which we can then see at first hand.
    I'm working on a template in APEX 4.2.1 where I need more than 8 region positions to display some reports in.
    Is there a way I can add more?
    No. Why do you think you need to?

    Multiple regions can be assigned to each region position, regions can contain subregions, and region layout controlled using region attributes and/or CSS.
  • 2. Re: How to create more than 8 body region positions like #REGION_POSITION_ID#
    984171 Newbie
    Currently Being Moderated
    Dear Paul,

    I'm sorry for not updating my name from the begining, I did it now. Hope is going to reflect the change...

    To better explain my issue I have created a demo application here:
    http://apex.oracle.com/pls/apex/f?p=63173
    user: demo
    pwd: demo

    I have generated 1 entry for Box, Sims, Phones Asset and Customers tabels.

    My problem arises when I go to the Print menu and try to generate multiple labels(please use number *1* for each text box). The paper contains 14 labels(7 rows /2 columns) so I need to have 14 reports being generated and then each one of them to render, if Box ID field is not null*, on the second page. This step is good, I have achieved it.
    The actual issue is after I hit the Print button, I'm not able to get all the reports on the next page (which is a Print Friendly customized page), because I only have 8 region positions to display in.

    Or maybe I can use a different method?

    Thank you.
    Tiberiu
  • 3. Re: How to create more than 8 body region positions like #REGION_POSITION_ID#
    fac586 Guru
    Currently Being Moderated
    981168 wrote:

    To better explain my issue I have created a demo application here:
    http://apex.oracle.com/pls/apex/f?p=63173
    user: demo
    pwd: demo
    Thanks for making the effort to do so.
    I have generated 1 entry for Box, Sims, Phones Asset and Customers tabels.

    My problem arises when I go to the Print menu and try to generate multiple labels(please use number *1* for each text box). The paper contains 14 labels(7 rows /2 columns) so I need to have 14 reports being generated and then each one of them to render, if Box ID field is not null*, on the second page. This step is good, I have achieved it.
    The actual issue is after I hit the Print button, I'm not able to get all the reports on the next page (which is a Print Friendly customized page), because I only have 8 region positions to display in.

    Or maybe I can use a different method?
    Use a single region and report with a custom named column template in which you define the required HTML structure, which will be repeated for each row returned.

    You can then use a print media style sheet to suppress unwanted page elements (tabs etc) from the printed output and optimize the formatting for print, using real-world measurements to fit the label layout.
  • 4. Re: How to create more than 8 body region positions like #REGION_POSITION_ID#
    984171 Newbie
    Currently Being Moderated
    Thank you Paul, I will try to implement your sugestion these days and I will let you know how it went.

    Tiberiu
  • 5. Re: How to create more than 8 body region positions like #REGION_POSITION_ID#
    984171 Newbie
    Currently Being Moderated
    Dear Paul,

    I followed your sugestion and seems to work better, but still I'm not able to make it run on a single report, with a single SQL querry.
    What I did:

    1. I created a new tamplate under Report Region, in shared components>templates, that is hosting the HTML table bellow:
    <table width="374", height="143.6" style="border:1px solid #333;background-color:#ddd;"> 
    <tr> 
    <th align="right"><b><big><u>BOX ID:</u></big></b></th> 
    <td><b><big><u>#NAMEA#</u></big></b></td> 
    </tr>
    <tr>
    <th align="right">Customer:</th> 
    <td>#NAMEB#</td>
    </tr>
    <tr>
    <th align="right">Asset No:</th> 
    <td>#NAMEC#</td> 
    </tr>
    <tr>
    <th align="right">IMEI:</th> 
    <td>#NAMED#</td> 
    </tr> 
    <tr>
    <th align="right">Phone No:</th> 
    <td>#NAMEE#</td> 
    </tr>
    <tr>
    <th align="right">SIM Card No:</th> 
    <td>#NAMEF#</td> 
    </tr>
    <tr>
    <th align="right">#EDOC:</th> 
    <td>#NAMEG#</td> 
    </tr>
    <table>
    2. I created a new page with one Region that is hosting 2 reports, one report that captures the BOX_IDs for column on the left and another report that captures the BOX_IDs for column on the right (odd and even)
    Left, for odd values:
    SELECT box_id NameA, 
    (select customers.last_name || ', ' || customers.first_name from customers where customers.customer_id = box.customer_id) NameB, 
    (select phones_asset.asset_no from phones_asset where phones_asset.asset_id = box.asset_id) NameC, 
    (select TO_CHAR(phones_asset.IMEI,'999999999999999') from phones_asset where phones_asset.asset_id = box.asset_id) NameD, 
    (select '0' || SIMS.PHONE_NO from sims where sims.sim_id = box.sim_id) NameE, 
    (select TO_CHAR(SIMS.SIMCARD_NO,'9999999999999999999') from SIMS where SIMS.SIM_id = box.SIM_id) NameF, 
    EDOC NameG 
    FROM box 
    WHERE box_id in (:P47_BOX_ID_M1, :P47_BOX_ID_M3, :P47_BOX_ID_M5, :P47_BOX_ID_M7, :P47_BOX_ID_M9, :P47_BOX_ID_M11, :P47_BOX_ID_M13)
    Right, for even values:
    SELECT box_id NameA, 
    (select customers.last_name || ', ' || customers.first_name from customers where customers.customer_id = box.customer_id) NameB, 
    (select phones_asset.asset_no from phones_asset where phones_asset.asset_id = box.asset_id) NameC, 
    (select TO_CHAR(phones_asset.IMEI,'999999999999999') from phones_asset where phones_asset.asset_id = box.asset_id) NameD, 
    (select '0' || SIMS.PHONE_NO from sims where sims.sim_id = box.sim_id) NameE, 
    (select TO_CHAR(SIMS.SIMCARD_NO,'9999999999999999999') from SIMS where SIMS.SIM_id = box.SIM_id) NameF, 
    EDOC NameG 
    FROM box 
    WHERE box_id in (:P47_BOX_ID_M2, :P47_BOX_ID_M4, :P47_BOX_ID_M6, :P47_BOX_ID_M8, :P47_BOX_ID_M10, :P47_BOX_ID_M12, :P47_BOX_ID_M14)
    I couldn't make it work in a single SQL querry, maybe you can hep me out on it.

    I have uploaded the code on the app with the link above and as you can see, they do not show on the same line, but one underneath the other.
    I tried playing with the Grid options so that I can push the even results on the second column and align it with the column 1, but without success.

    Any ideeas or sugestions?

    PS: I have created 2 more values for BOX ID, so you can try out 1,2,3 and 4.

    Thank you once more,
    Tiberiu.

    Edited by: Tiberiu20!3 on 13.01.2013 03:03
  • 6. Re: How to create more than 8 body region positions like #REGION_POSITION_ID#
    fac586 Guru
    Currently Being Moderated
    Tiberiu20!3 wrote:
    Dear Paul,

    I followed your sugestion and seems to work better, but still I'm not able to make it run on a single report, with a single SQL querry.
    What I did:

    1. I created a new tamplate under Report Region, in shared components>templates, that is hosting the HTML table bellow:
    WHAT are you using as an HTML reference? Much of this is invalid or obsolete. When you have problems with templates it is always a good idea to run the page through an HTML Validator, which will identify HTML problems. Validators are also available as plug-ins for some browsers.
    <table width="374", height="143.6" style="border:1px solid #333;background-color:#ddd;"> 
    <li>HTML attributes for an element are separated by white space. Remove the ",".
    <li>The <tt>width</tt> and <tt>height</tt> attributes on <tt>table</tt> are obsolete. You should use CSS to specify dimensions for an element. (<tt>width</tt> and <tt>height</tt> specify dimensions in pixels, so "143.6" does not make sense anyway.)
    <tr> 
    <th align="right"><b><big><u>BOX ID:</u></big></b></th> 
    <td><b><big><u>#NAMEA#</u></big></b></td> 
    </tr>
    <li>The <tt>align</tt> attribute on <tt>th/td</tt> is obsolete. Use CSS to specify alignment within an element.
    <li>The <tt>big</tt> element is obsolete. Use CSS to specify font size.
    <li><tt>b</tt> and <tt>u</tt> are obsolete as presentational elements, and this use is non-conforming for their new semantics. Use CSS to specify font weight and text decoration.
    <tr>
    <th align="right">Customer:</th> 
    <td>#NAMEB#</td>
    </tr>
    <tr>
    <th align="right">Asset No:</th> 
    <td>#NAMEC#</td> 
    </tr>
    <tr>
    <th align="right">IMEI:</th> 
    <td>#NAMED#</td> 
    </tr> 
    <tr>
    <th align="right">Phone No:</th> 
    <td>#NAMEE#</td> 
    </tr>
    <tr>
    <th align="right">SIM Card No:</th> 
    <td>#NAMEF#</td> 
    </tr>
    <tr>
    <th align="right">#EDOC:</th> 
    <td>#NAMEG#</td> 
    </tr>
    <table>
    <li>The last tag should be <tt>&lt;/table&gt;</tt> to close this table.

    It might be counterintuitive, but I probably wouldn't use a table for this. By default, HTML tables and table cells expand to fit their contents, which makes it more difficult to control things in an application that requires fixed dimensions like label printing. In this case I'd probably use an unordered list of description lists. This is a one-dimensional linear structure that can be made to flow across/down the page using CSS to adapt easily to different layouts, unlike the fixed 2-dimensional grid of a table.

    This also avoids the need for 2 reports (which I doubt is even necessary if using a table-based layout).
    2. I created a new page with one Region that is hosting 2 reports, one report that captures the BOX_IDs for column on the left and another report that captures the BOX_IDs for column on the right (odd and even)
    Left, for odd values:
    SELECT box_id NameA, 
    (select customers.last_name || ', ' || customers.first_name from customers where customers.customer_id = box.customer_id) NameB, 
    (select phones_asset.asset_no from phones_asset where phones_asset.asset_id = box.asset_id) NameC, 
    (select TO_CHAR(phones_asset.IMEI,'999999999999999') from phones_asset where phones_asset.asset_id = box.asset_id) NameD, 
    (select '0' || SIMS.PHONE_NO from sims where sims.sim_id = box.sim_id) NameE, 
    (select TO_CHAR(SIMS.SIMCARD_NO,'9999999999999999999') from SIMS where SIMS.SIM_id = box.SIM_id) NameF, 
    EDOC NameG 
    FROM box 
    WHERE box_id in (:P47_BOX_ID_M1, :P47_BOX_ID_M3, :P47_BOX_ID_M5, :P47_BOX_ID_M7, :P47_BOX_ID_M9, :P47_BOX_ID_M11, :P47_BOX_ID_M13)
    Why use scalar subqueries instead of joins here? Is it because some of the information may not exist for all boxes?

    I'm also not keen on the fixed grid of parameters and the hard-coded IN-list. Could these not be supplied using a tabular form or List Manager item? These could be inserted into a collection and matched using a join, or used to create a dynamic IN-list in a PL/SQL Function Body returning SQL Query report source.
    Right, for even values:
    SELECT box_id NameA, 
    (select customers.last_name || ', ' || customers.first_name from customers where customers.customer_id = box.customer_id) NameB, 
    (select phones_asset.asset_no from phones_asset where phones_asset.asset_id = box.asset_id) NameC, 
    (select TO_CHAR(phones_asset.IMEI,'999999999999999') from phones_asset where phones_asset.asset_id = box.asset_id) NameD, 
    (select '0' || SIMS.PHONE_NO from sims where sims.sim_id = box.sim_id) NameE, 
    (select TO_CHAR(SIMS.SIMCARD_NO,'9999999999999999999') from SIMS where SIMS.SIM_id = box.SIM_id) NameF, 
    EDOC NameG 
    FROM box 
    WHERE box_id in (:P47_BOX_ID_M2, :P47_BOX_ID_M4, :P47_BOX_ID_M6, :P47_BOX_ID_M8, :P47_BOX_ID_M10, :P47_BOX_ID_M12, :P47_BOX_ID_M14)
    I couldn't make it work in a single SQL querry, maybe you can hep me out on it.

    I have uploaded the code on the app with the link above and as you can see, they do not show on the same line, but one underneath the other.
    This is because of the lack of a closing <tt>&lt;/table&gt;</tt> tag as described above.
    I tried playing with the Grid options so that I can push the even results on the second column and align it with the column 1, but without success.

    Any ideeas or sugestions?
    Quite a lot, as you can see. If you post guest developer credentials for your apex.oracle.com workspace and provide more detail on the requirements I'll create an example.

    <li>What browser(s)/version(s) are you using?
    <li>What are the dimensions of the labels? The margins on the sheets and between labels?
    <li>Is it necessary to print only one page of labels at a time, or could/do you want to be able to specify more than 14 at a time?
  • 7. Re: How to create more than 8 body region positions like #REGION_POSITION_ID#
    984171 Newbie
    Currently Being Moderated
    Hi Paul,

    Seems I'm doing a lot of mistakes in there, that's mostly because I'm a rookie in CSS and HTML :)

    I have granted developer access to the Demo user now:

    http://apex.oracle.com/pls/apex/f?p=4550
    workspace: blackberry_europol
    user: demo
    pwd:demo

    Regarding browsers, I'm using:

    Firefox 18.0
    IE 10

    Labels' dimensions are:

    paper size: A4
    top margin: 1,5 cm
    bottom margin: 1,5 cm
    left margin: 0,5 cm
    right margin: 0,5 cm

    label size:
    L: 9,9 cm
    l: 4,8
    vertical distance between labels: 0,0 cm
    horizontal distance between labels: 0,3 cm

    The printout should be flexible, depending on the input of the user, 1 up to 14 labels at a time.

    Thank you very much.
    Tiberiu
  • 8. Re: How to create more than 8 body region positions like #REGION_POSITION_ID#
    fac586 Guru
    Currently Being Moderated
    Tiberiu20!3 wrote:

    Labels' dimensions are:

    paper size: A4
    top margin: 1,5 cm
    bottom margin: 1,5 cm
    left margin: 0,5 cm
    right margin: 0,5 cm

    label size:
    L: 9,9 cm
    l: 4,8
    vertical distance between labels: 0,0 cm
    horizontal distance between labels: 0,3 cm
    Can you double check this? Doesn't add up.

    A4 is 210&times;297mm, but these measurements give

    W = (2 &times; 5) + (2 &times; 99) + 3 = 211mm

    H = (2 &times; 15) + (7 &times; 48) = 366mm

    99.1&times;38.1mm seems to be the standard size for 14 label sheets?
  • 9. Re: How to create more than 8 body region positions like #REGION_POSITION_ID#
    984171 Newbie
    Currently Being Moderated
    Yes, that's the right label size: 99mm × 38mm

    A mistake(or more) sneaked in:
    Tiberiu20!3 wrote:
    l: 4,8
    The right ones are as following:

    paper size: A4
    top margin: 15,5 mm
    bottom margin: 15,5 mm
    left margin: 4 mm
    right margin: 4 mm

    label size:
    L: 99 mm
    H: 38 mm
    vertical distance between labels: 0,0 mm
    horizontal distance between labels: 4 mm

    I did the calculations and now it is adding up.

    Thanks,
    Tiberiu

    Edited by: Tiberiu20!3 on Jan 15, 2013 3:25 AM
  • 10. Re: How to create more than 8 body region positions like #REGION_POSITION_ID#
    984171 Newbie
    Currently Being Moderated
    Well Paul, that is a really good example, exactly what I was needed. I don't know why I didn't think about using joins in building the report the way you did :)

    Thank you so much for the effort and patience you had to help me out.

    Best Regards,
    Tiberiu

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points