Help : Javascript in report template

Hi,
I created a report template named "MyFirstTemplate". In this template I use javascript to print an optionnel field named "COMMENTARY" when it is not empty here is the code :
<br><br>
<script language="javascript"><br>
if("#COMMENTARY#" != " - ") // because null caracter is replaced by " - "<br>
{     <br>
document.writeln('<tr>')<br>
document.writeln('<td class="t2data" colspan=6>')<br>
document.writeln('<font color="#7E587E#"><b>Commentary: </b></font>') <br>
document.writeln('#COMMENTARY#')<br>
document.writeln('</td>')<br>
document.writeln('</tr>')<br>
}<br>
</script><br>
<br><br>
My problem is :<br>
1. When commentary have " ' " caracter like : " It's a good deal ", I will have an error message like : ")" is missing on line... <br>
I guess it's on this line : document.writeln('#COMMENTARY#') .
Does anybody knows how to fix it ?
<br><br>
2. How can I know if the field is empty without using this " - " in
if("#COMMENTARY#" != " - ") ?<br><br>
Thanks a lot.<br>
Benn

Thank you ageller1, it works.
<br><br>
I use this :<br><br>
if(escape("#COMMENTARY#") != " - "){<br>
. . . <br>
var Commentary_esc = escape("#COMMENTARY#") <br>
...<br>
document.writeln('Commentary : ', unescape(Commentary_esc))<br>
...<br>
}<br><br>
Tks a lot<br>
Benn

Similar Messages

  • Putting Javascript in report template

    See Swapping columns on reports
    In order to be able to use that "move columns" feature in any report region, I put the necessary Javascript functions in the report template. This way, if any report region on the page needs that feature, it can just switch to that template and its done.
    But if multiple report regions on a page use this template, then the Javascript functions will be defined over and over again, for each report region.
    Is this a problem? Should this be avoided?
    Thanks

    But if multiple report regions on a page use this template, then the Javascript
    functions will be defined over and over again, for each report region. I haven't started using much Javascript in my app yet (one thing at a time... playing with CSS's is my hobby at the moment.. :) ). However, I don't see a reason offhand why you couldn't simply put your javascript functions in the Page template rather than the region template. There may be pages where the Javascript isn't needed, but it will never be defined multiple times.
    Alternately you could (going further out on a limb here) put an application item into your page template (i.e. &GLOBAL_JAVASCRIPT.). Make a JS_FUNCTIONS table with a column for the javascript text and a second column with a colon-delimited list (i.e. what a multiple-select list would generate) of the pages that need them (possibly a third column for a description and a fourth for a category). Then write a function to select from that table to built the SCRIPT section dynamically with the javascript functions you need on that particular page -- then set the app item with that text using the 'Before Header' event.
    Any time you create/find a new javascript function you like, you can open up your HTMLDB add/edit page for JS_FUNCTIONS, add in the new function code/description/category and use the multiple-select list to pick which pages ought to have that function included on them. This would also make a great repository for javascript function you find and like... but don't currently need.
    Mind you there may be half a dozen reasons why this won't work, but it looks good on paper... er screen.

  • Custom report templates with the help of BI Publisher.

    Hi All,
    I have created custom report templates with the help of BI Publisher it is working as we excepted.
    refered : https://blogs.oracle.com/kyle/tags/reports
    But our requirement want to change the color of heading and include filters in output report, It is possible, if yes pls share you comments?
    Best Regards
    Pradeep

    how silly of me!
    just restarting the tomcat sorted the problem!!!

  • Report Template Help - Vertical report with multiple rows on the same line.

    I am tearing my hair out trying to figure a way to do this. I want a vertical report, but with the rows across the page rather than down it.
    e.g.
    ROW1    ROW2    ROW3    ROW4   ROW5
    ROW1    ROW2    ROW3    ROW4   ROW5
    ROW1    ROW2    ROW3    ROW4   ROW5
    ROW1    ROW2    ROW3    ROW4   ROW5
    ROW1    ROW2    ROW3    ROW4   ROW5
    ROW1    ROW2    ROW3    ROW4   ROW5
    ROW1    ROW2    ROW3    ROW4   ROW5
    ROW1    ROW2    ROW3    ROW4   ROW5Has anyone managed to do this?

    Use a custom named column report template. The template could generate either:
    <li> a table with one physical <tt>tr</tt> row, with your "columns" being the logical "rows" of the report rendered as the <tt>td</tt>s within the row
    <li> a list of lists using CSS to render them side-by-side via <tt>float</tt> or <tt>inline-block</tt> (Some examples of similar techniques)

  • Report template substitution strings?  (APEX 2.2.0)

    Hi all,
    I am trying to customize a report template. I would like to know if there is a way to get the sort link that goes into the column headers. The next page and previous page links have the #LINK# substitution string. #COLUMN_HEADER# doesn't give me enough flexibility.
    Would I have to use a named column template for this? (I don't have much idea what that is. I read about it on Scott Spendolini's blog entry on "Click in a Row".)
    Cheers!

    Hello,
    >> I could using JavaScript rewrite the column header to be what I want after the page renders, but I'd rather it show up the way I want in the first place
    Can you be more specific about what is it that you want? The report engine allows you to use custom headings. Can’t that feature help you achieve what you want?
    >> Is there a list of the substitutions strings that are available to the column header?
    The substitution strings you see on the templates populated by the APEX engine with snippets of code you can’t control. You can define your own substitution strings, in the application definition page (under shared components), set them with the code you need, and use them throughout the application, including in templates. The way to use them is a bit different – instead of the “#STRING# syntax, you need to use the “&STRING.” Syntax.
    Regards,
    Arie.

  • 2 Mileage Policy Schedules on the same Expense report Template

    Hi,
    I am trying to create another mileage rate schedule and put in the same expense report template. It works and when you input mileage information for trip X,Y,Z on the Expense Report, the choice is there (drop down list) and the correct rate is automatically included in calculations.
    The thing is that the project expenditure fields are grey and cannot input project/task etc.. I think I did the whole setup whether its on the Project Billing or Costing (expenditure category/type) and Payables Manager (ER template).
    Am i Missing something?
    Thank you,
    Edited by: 985580 on Mar 15, 2013 8:55 AM

    Roseline,
    Create a new button and select the option to create the button as an item and not in the region position.
    Item buttons behave differently to Region Position buttons.
    If you are wanting to use the button to "SUBMIT" the page, you will need to change the button to Target is a URL and add javascript:doSubmit('YOUR_REQUEST_VALUE');
    Gus..
    REWARDS: Please remember to mark HELPFUL or CORRECT posts on the forum, not just for my answers but for everyone!
    ;-)

  • Report Template href with column value

    I have created a Report template and want to have a field that is a href with link to other page passing column value. I'm having trouble passing the column value. If I hard code the value the href code works. If I try to pass #1# or the column name with # surrounding the link doesn't work. Any ideas would be appreciated.
    This works:
    <td><img src="/i/edit.gif" border="0" alt="Edit Icon">
    </td>
    This doesn't:
    <td><img src="/i/edit.gif" border="0" alt="Edit Icon">
    </td>
    Thanks
    Mary Jo Al-Shihabi

    Hi Sergio, thanks I finally got it working using a call to javascript:popupURL.
    <td><align="center">#PORT_APP_ID#</td>
    Thanks
    Mary Jo

  • #REGION_STATIC_ID# does not work in report template for PPR

    I was hoping to use the new substitution string #REGION_STATIC_ID# for a PPR report, because when we do Export/Import of the app the Region ID changes and we have to manually change the Pager Header Javascript to get the PPR to work. A real pain.
    So I changed the Region template to use #REGION_STATIC_ID# and set the Static id in the region definition - this worked fine. Next, I modified the Report template for PPR to use #REGION_STATIC_ID#, but at runtime this resolves to a blank! I assumed it would pick up the static ID for the region it was in. Is this a bug or am I just not understanding the way it is supposed to work?
    Regards,
    Steve

    Hello,
    #REGION_STATIC_ID# is available in some places in the report template. But the PPR javascript uses the APEX engine created ID get into the fast track report engine so it's not going to work that way.
    But you can still do what you want to do what you want to do. Use the #REGION_STATIC_ID# in your region say something like this #REGION_STATIC_ID#_body the use the javascript to get that element and then use that element
    along with getElementsByClass(searchClass,node,tag)
    http://apex.oracle.com/pls/otn/f?p=38704:2:::NO::P2_ID1:22
    to grab the report table and then it's ID which you can then feed into your javascript. It will only be 2-3 more lines of javascript.
    Carl

  • How to Set Report Template for CRDesigner control 11.5 (RDC control)?

    Hai,
    I am using the CR Designer control (CR XI R2 RDC) in VB6.0. I have crystal report templates available in Web Server.
    want to load these templates in CRDesigner control through VB6.0, Is it possible?
    Thanks
    Kesavan
    Edited by: kesavan1986 on Jul 22, 2010 8:12 PM

    It does not matter where the reports are. If you can open them up in the CR designer (crw32.exe) you can open them using any CR SDK.
    RDC samples are here:
    https://www.sdn.sap.com/irj/boc/businessobjects-samples
    RDC Developer Help File:
    C:Program FilesBusiness ObjectsCrystal Reports 11.5Helpen
    dcsdk_com_dg_docdoc
    dcsdk_com_dg.chm
    Ludek
    Follow us on Twitter http://twitter.com/SAPCRNetSup

  • Report template enhancement? no data found message

    I have a layout in which I want to show the excel export link in the same html table as a logo, so that code needs to be placed in the report template, but when no data is found I still want to show the logo and so all my reports have the same html code in the "no data found" field. Whenever I want to change this I have to change my template as well as all of my reports.
    Wouldn't it be a nice idea to provide for a "no data found" message in the report template instead of the report itself? I can imagine you would want to show the same "no data found" message anyway for all reports so the template would be a logical place to put this.

    There are known issues with Interactive Reports referencing :REQUEST value, probably due to some inner logic that also handles it simultaneously - potentially causing malfunction or deadlocks.
    One workaround I've learned is to create a computation to assign :REQUEST to a temporary item (a PXX_REQUEST, for instance) and reference it in the query, instead of :REQUEST. This has worked fine for me in my experience.
    Let me know if that helps - pls sign the thread as 'Useful' or 'Correct' if so, hence more people can benefit.
    tks,
    Kleber

  • Need Date manipulation in BI Publisher report template

    Hi All,
    I need date manipulation in BI Publisher report template for e.g sysdate+4 this means i need 4 days after todays sysdate.
    That menas if today date(sysdate) is 09/01/2008 then i need (sysdate+4) i.e 13/01/2008.
    Please help me.
    Thanks
    Edited by: user562690 on Jan 9, 2009 3:21 PM

    Hi M14,
    I have doubt on similar type.I have AgreementStartDate as
    <AgreementStartDate>12/03/2008 07:24:10</AgreementStartDate> in XML format.
    I am not able to apply same formula for thsi date format in similar manipulation.
    Please help me.
    TIA
    skr

  • Crystal Report and Dash Board Report templates

    Hi All,
    I was wondering can you help to find out few Crystal report and Dash Board report Templates for SAP Business One.
    This in order to give demo to customers.
    Link pointing to same is good enough. I have authorization to SAP portal and I have searched through it found only two template of Crystal report no Dash report templates.
    Regards,
    Aditya

    Hi Adit,
    For CR demo, you can use this youtube CR demo:
    http://www.youtube.com/watch?v=bKLtTDNpQMM
    For the CR sample templates donwload, you can check this link:
    http://scn.sap.com/thread/1239521
    If  you want to create the template by your self, you can check this link:
    http://scn.sap.com/thread/1627677
    For dashboard sample, you can download from this link:
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/e0bd3605-e1ad-2d10-488d-f2e4fede1d46
    JimM

  • Report Template, Column Template, Column Template Condition

    I have a template, Standard Revenue from Standard, I have cloned for a Classic report.
    Application ###>Shared Componets>Templates>Edit Report Template
    Column Template 1 looks like:
    <td#ALIGNMENT# headers="#COLUMN_HEADER_NAME#" class="t1data_revenue">#COLUMN_VALUE#</td>
    I have set Column Template 1 Condition to:
    "Use based on PL/SQL expresiion"
    I have tried several expression in "Column Template 1 Expression" - last one is:
    case
    when #COLNUM# <= 2 then false
    when #COLUMN_VALUE# < 0 then true
    else false
    end case;
    I am trying to use the value in "Column Template 2" when to value of the #COLUMN_VALUE# < 0
    where "Column Template 2" is :
    <td#ALIGNMENT# headers="#COLUMN_HEADER_NAME#" class="t1data_revenue_negative">#COLUMN_VALUE#</td>
    I get the following error when I run the page:
    ORA-01403: no data found
    and
    ERR-1025 Error processing PLSQL expression. case when #COLNUM# <= 2 then false when #COLUMN_VALUE# < 0 then true else false end case;
    Any help will be appreciated.
    thank you,
    jwm

    Hi,
    That's actually easier. See: [http://apex.oracle.com/pls/otn/f?p=267:60]
    The SQL for both reports is:
    SELECT EMPNO, ENAME, NVL(SAL,0) SAL, NVL(COMM,0) COMM
    FROM EMP
    ORDER BY EMPNOThe SAL and COMM columns have been formatted using:
    999G999G999G999G990D00For the Row Template, the Row Template 1 setting contains an empty space (you have to have something in there otherwise Apex adds back in a default row containing five cells!). The condition for this is:
    TO_NUMBER('#COMM#','999G999G999G999G990D00') < 100The template will see the data as a string, so we use the same number format to convert that string back into a number and compare this to 100. If we didn't use formatting on the numbers and we are sure that every row contained a number (hence the use of NVL()), then you could use:
    #COMM# < 100Row Template 2 contains the format for the rows that need displaying:
    &lt;tr&gt;
    &lt;td class="t18Data"&gt;#1#&lt;/td&gt;
    &lt;td class="t18Data"&gt;#2#&lt;/td&gt;
    &lt;td class="t18Data" style="text-align:right"&gt;#3#&lt;/td&gt;
    &lt;td class="t18Data" style="text-align:right"&gt;#4#&lt;/td&gt;
    &lt;/tr&gt;and is unconditional.
    The only other settings on the Row Template are the Before Rows:
    &lt;table class="t18Standard" style="border-collapse:collapse; border:1px solid black;"&gt;
    &lt;tr&gt;
      &lt;th class="t18ReportHeader"&gt;Empno&lt;/th&gt;
      &lt;th class="t18ReportHeader"&gt;Ename&lt;/th&gt;
      &lt;th class="t18ReportHeader" style="text-align:right"&gt;Sal&lt;/th&gt;
      &lt;th class="t18ReportHeader" style="text-align:right"&gt;Comm&lt;/th&gt;
    &lt;/tr&gt;and After Rows:
    &lt;/table&gt;Of course, you will note that the record counters at the bottom still show the number of records in both reports - as the SQL still outputs the same data, this doesn't change.
    Andy

  • Report Template - Standard, Alternating Row Colors

    I'm using APEX 4.1.0 and theme 22 on Oracle 10g.
    I have some tabular forms in my application. For 2 of those, row deletions are allowed and I have the usual select box column to manage the row deletions. Also my users like the "Standard, Alternating Row Colors" report template and would like to see the alternating row colors whenever possible. Unfortunately I get the "Error on page." browser error in IE when I check a row selector box using this template. When I use a different report template I don't get this error.
    The tabular form functions correctly so this error is harmless, but I would like to know what it is for. I'm sure my users would rather not see that error.
    By the way, in Firefox the firebug error count increases and I get the following error in the console:
    TypeError: can't convert undefined to object
    [Break On This Error]      
    ...ovedColor)}gLastRowMoved=b}function html_RowUp(e,d){var c=$x_UpTill(e,"TR");ie_R...
    apex_4_1.min.js (line 18)Because all of the whitespace has been helpfully removed :) it's hard to see which expression is undefined and why.
    Any ideas?

    Hi Jackie,
    There must be some issues the apex_4_1.min.js file, try to reload it. In apex.oracle.com the tabular form with "Standard, Alternating Row Colors" just works fine.
    Regards,
    Natarajan

  • Report Template does not save

    HI,
    I am creating a new report template. On save I get this error: Error occurred while saving the document template; save again.  Although I save again, it does not save the layout. At this stage I don't check the symbols as I have not yet created any into the layout.  Even though I say 'check', it does not save at all.
    Can anyone help.  I have checked the File locations for Template folder to be correct C:\....\SAP\FrontEnd\SAPgui\wwi
    Am on GUI 7100.3.12
    Patch 12
    Any recommendations ? Thanks

    Hello Sanjay,
    It seems to be DMS configuration issue. May be your system is trying to store the template document to external database by using "kpro". Please check for following two configurations:
    1. Go to Basic Data & Tools-->Report Definition >Settings for Document Management>Assign EHS doc type to DMS doc type Here for doc type "SBV" , Ty. should be "SBV" and Data Carrier should be "SAP System" if you are not specifying any     external server for document storage.
    2. Next, Go to Basic Data & Tools-->Report Definition >Settings for Document Management> Check Doc types and doc statuses.  Go to the "Details" of doc type "SBV", and uncheck "kpro" if checked.
    If you have configured external server for WWI docs, then you need to define different data carrier.
    Please tell if it solves your problem, otherwise you may be probably having problem with your document status management.
    In that case, you may like to refer following SAP notes in sequence.
    995736,1005225,1091699.
    regards
    Pavan

Maybe you are looking for

  • Does not work after upgrading to IOS6

    After upgrading to iOS6 my home sharing does not work.  I have tried every fix I could find but still it is not working.  Please help

  • How can we block double invoicing ?

    Hello Experts , I have done PO for quantity 1 , with GR based IV ticked & invoice receipt ticked . When I create IR for this , it allows me to create it twice with quantity 1. Whether there is any way we can block this ?  (GR is statistical since it

  • Cant install Icloud on pc windows 7

    I have a dell with windows 7 and I am trying to upload Icloud so that I can back up all my music I have downloaded from cds.  During the final phase of installation, I am told that I cannot finish due to a system problem with Microsoft

  • Reformatting WD Elements External HDD problem

    I have a problem with my WD Elements 2TB hard drive. So a little background. I have a mid-2010 MacBook, 8GB RAM 2.4GHz Core 2 Duo, 250GB HD, OSX Lion 10.7.4. The hard drive is a 2TB USB external Western Digital Elements formatted to NTFS. So, I used

  • To Huffer where ever you may be.

    Hi again Huffer. I did a recovery on my system and tried the Kubuntu. It ended up the same as Mint. No Grub, so I reinstalled Mint 17. It ended up the same. It's going to be good enough. I'm getting used to the ESC> F9>Boot Options> ubuntu. Just a ma