This discussion is archived
10 Replies Latest reply: Nov 27, 2012 1:26 AM by TobiP RSS

Customized Report Tamplate: null-Values get rendered to Blanc-char

TobiP Explorer
Currently Being Moderated
Greetings!

In my report template I use substitution strings with the format #ENAME# inside the <tr>-tags. In the report attributes under "Layout and Pagination" the value for "Show Null Values as" is left blanc, so that null-values are not rendered in the markup. Still in the html they are rednered to the '& nbsp;' html whitespace.

Also arbitrarily whether the column formating if turned to "Standard Report Columne" or "Display as Text(excape special characters)", also whether "Strip HTML Tags" is selected Yes or No.

Does anybody know how this can be solved?

Thanks for help, with best regards,
tobi
  • 1. Re: Customized Report Tamplate: null-Values get rendered to Blanc-char
    fac586 Guru
    Currently Being Moderated
    TobiP wrote:
    Greetings!

    In my report template I use substitution strings with the format #ENAME# inside the <tr>-tags. In the report attributes under "Layout and Pagination" the value for "Show Null Values as" is left blanc, so that null-values are not rendered in the markup. Still in the html they are rednered to the '& nbsp;' html whitespace.

    Also arbitrarily whether the column formating if turned to "Standard Report Columne" or "Display as Text(excape special characters)", also whether "Strip HTML Tags" is selected Yes or No.

    Does anybody know how this can be solved?
    This is a long-time APEX "feature" included because of legacy browsers that will only render table cells if they contain some content.

    Exactly what problem is this causing, and what do you need to be "solved"?

    -----

    When you have a problem you should provide as much relevant information as possible upfront. This would normally 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)
  • 2. Re: Customized Report Tamplate: null-Values get rendered to Blanc-char
    TobiP Explorer
    Currently Being Moderated
    Hi fac!

    My problem is this: when an entire html-row contains no values, it will be displayed at a zero hight - what I prever for room efficency reasons. But when all empty cells contain a blanc char, I have some excessive areas in the table.

    The data for one record is displayed over tree rows, the last one spanning the entire table. For this last row I worked around wich a conditional select
        (...)
         case when qmmUserNote is not null then
            '<tr><td colspan="5">Anmerkung: ' || qmmUserNote || '</td></tr>'
            else null end                                             USERNOTE
    So if empty, the entire row is not displayed at all, althou there is an invalid space-character in the markup (after the </tr>-end tag). Works fine in Firefox, but Internet Explorer moves this excessive space-char to the top of the table, so that for each empty row, there appeares an extra blanc row in the top.

    Same result, when I write:
     (...)
              else '' end
    So to work around this extra blanc, I changed that last output into:
         case when qmmUserNote is not null then
            '<tr><td colspan="5">Anmerkung: ' || qmmUserNote || '</td></tr></tbody>'
            else '</tbody>' end                                             USERNOTE
    , meaning, more html-tags get moved to the data operation side, away from the template, which is just not so nice and all a bit messy.

    Edit: Btw: working with 4.2

    Edited by: TobiP on 26.11.2012 06:15
  • 3. Re: Customized Report Tamplate: null-Values get rendered to Blanc-char
    fac586 Guru
    Currently Being Moderated
    TobiP wrote:
    Hi fac!

    My problem is this: when an entire html-row contains no values, it will be displayed at a zero hight - what I prever for room efficency reasons. But when all empty cells contain a blanc char, I have some excessive areas in the table.

    The data for one record is displayed over tree rows, the last one spanning the entire table. For this last row I worked around wich a conditional select
        (...)
    case when qmmUserNote is not null then
    '<tr><td colspan="5">Anmerkung: ' || qmmUserNote || '</td></tr>'
    else null end                                             USERNOTE
    So if empty, the entire row is not displayed at all, althou there is an invalid space-character in the markup (after the </tr>-end tag). Works fine in Firefox, but Internet Explorer moves this excessive space-char to the top of the table, so that for each empty row, there appeares an extra blanc row in the top.

    Same result, when I write:
     (...)
    else '' end
    So to work around this extra blanc, I changed that last output into:
         case when qmmUserNote is not null then
    '<tr><td colspan="5">Anmerkung: ' || qmmUserNote || '</td></tr></tbody>'
    else '</tbody>' end                                             USERNOTE
    , meaning, more html-tags get moved to the data operation side, away from the template, which is just not so nice and all a bit messy.
    I'd suggest moving the conditional processing into the template using conditional row templates based on PL/SQL expressions, so that the final row is not output if <tt>qmmUserNote</tt> is null.
  • 4. Re: Customized Report Tamplate: null-Values get rendered to Blanc-char
    TobiP Explorer
    Currently Being Moderated
    Cool, thanks, fac, thats a good idea.

    It at least helps for that one row. The middle row has 4 values, eigther of which can be null. There I would need a bit too many options in the contitional templates to take all combinations into account, thou. ;)
  • 5. Re: Customized Report Tamplate: null-Values get rendered to Blanc-char
    TobiP Explorer
    Currently Being Moderated
    Actually its not done. I tried to go with your suggestion, but I am getting an pl/sql-expression error.
    As sugested in the documentation I set the 1st. contitional row template to
    #USERNOTE# is null
    , the 2nd. to
    #USERNOTE# is not null
    Should be an expression alright, but somehow the substitution does not get rendered, because I get the error:
    report error:
    PLS-00103: Found the Symbol "IS" when one of the following was expected:
    
       ( - + case mod new not null 
         avg...
    I also tried
    nvl(#USERNOTE#, 1) = 1
    there, apex finds the symbol "," as an error...

    Any way to fiy that?
  • 7. Re: Customized Report Tamplate: null-Values get rendered to Blanc-char
    fac586 Guru
    Currently Being Moderated
    TobiP wrote:
    Actually its not done. I tried to go with your suggestion, but I am getting an pl/sql-expression error.
    As sugested in the documentation I set the 1st. contitional row template to
    #USERNOTE# is null
    , the 2nd. to
    #USERNOTE# is not null
    Should be an expression alright, but somehow the substitution does not get rendered, because I get the error:
    report error:
    PLS-00103: Found the Symbol "IS" when one of the following was expected:
    
    ( - + case mod new not null 
    avg...
    I also tried
    nvl(#USERNOTE#, 1) = 1
    there, apex finds the symbol "," as an error...

    Any way to fiy that?
    <tt>#USERNOTE#</tt> is a text substitution, not a bind variable. Conditions therefore have to include quotes so that comparisons are performed using string literals in PL/SQL expressions:
    '#USERNOTE#' is not null
  • 8. Re: Customized Report Tamplate: null-Values get rendered to Blanc-char
    TobiP Explorer
    Currently Being Moderated
    Thank you again, fac, that solved it.
  • 9. Re: Customized Report Tamplate: null-Values get rendered to Blanc-char
    fac586 Guru
    Currently Being Moderated
    TobiP wrote:
    Hi fac!

    My problem is this: when an entire html-row contains no values, it will be displayed at a zero hight - what I prever for room efficency reasons. But when all empty cells contain a blanc char, I have some excessive areas in the table.

    The data for one record is displayed over tree rows, the last one spanning the entire table. For this last row I worked around wich a conditional select
        (...)
    case when qmmUserNote is not null then
    '<tr><td colspan="5">Anmerkung: ' || qmmUserNote || '</td></tr>'
    else null end                                             USERNOTE
    So if empty, the entire row is not displayed at all, althou there is an invalid space-character in the markup (after the </tr>-end tag). Works fine in Firefox, but Internet Explorer moves this excessive space-char to the top of the table, so that for each empty row, there appeares an extra blanc row in the top.

    Same result, when I write:
     (...)
    else '' end
    So to work around this extra blanc, I changed that last output into:
         case when qmmUserNote is not null then
    '<tr><td colspan="5">Anmerkung: ' || qmmUserNote || '</td></tr></tbody>'
    else '</tbody>' end                                             USERNOTE
    , meaning, more html-tags get moved to the data operation side, away from the template, which is just not so nice and all a bit messy.
    Yes, this is messy: it violates the principle of the separation of concerns. However, on occasion combining logic in the query and the template allows more variations to be handled using a standard report, rather using PL/SQL which is quite horrible. I try to keep as much separation as possible by having the row structures in the templates and only generating closing tags in the query. This is also useful in avoiding repetition in row templates, where the only difference between templates is a closing tag (see +{message:id=9816577}+ for an example).

    Switching from XHTML to HTML5 is also helpful as it means that closing tags for <tt>th</tt>, <tt>td</tt> <tt>tr</tt> and <tt>tbody</tt> elements is optional: they are implied by opening the next element.

    A final option to avoid using PL/SQL (either the hopelessly obsolete HTF package or grotesque hard coding of HTML and an impenetrable thicket of "||"s) is to abandon the separation of concerns completely and Re: check box number of layout columns, which can be incorporated in a report with a custom template or output in a PL/SQL region using <tt>htp.p</tt>.
  • 10. Re: Customized Report Tamplate: null-Values get rendered to Blanc-char
    TobiP Explorer
    Currently Being Moderated
    Yes, the latter is a quite extreme approach, when dealing with Apex. I have also seen a similar example, where the entire html is generated in the query and as a template there is only a plane report with one columne with all html-tags unstripped. Interesting to see how there are always several solutions, the work lies in finding the best suited.
    Having conditional templated is a quite nice solution for some situations.

    I have switched the page template to HTML5 already. That you dont need closing tags there is new to me. But I find it not so nice, cause to my understanding it kinda corrupts the idea of having a xml-like structure. May come in handy thou nevertheless, maybe.

    I will have a good look at the links you posted for future reference. Thanks again,
    best regards,
    Tobi

Legend

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