Using JavaScript / Custom function in ACTION_BEFORE_RENDERING

Hi
I need to include some of my own text in the print output of a template. On the template, I can include a text item, and include that text item in the print output. The problem, however, is that when printed, the text item's initial value is in the print output.
So, I parametize the text item to include the Query Name, for example, and that value comes through in the print output.
However, the client's request for some additional text to be included, namely the name of the iview. I can write JavaScript to extract the data they want included, and I can write the JavaScript to update the text item once the page has loaded, but the PDF generation doesn't seem to take that into account.
I see on the Web Template Parameters there is a parameter called ACTION_BEFORE_RENDERING ... that seems to work nicely, but I can only hardcode a static value in there, or use one of the built in commands. This would probably work nicely for me, but I would need to call a JavaScript function ... any ideas?
Cheers,
Andrew

HI
Unfortunately, I didn't find a solution for that,
I believe the problem is because you can run java scripts only after the whole report is loaded, so the only option is to run a command.
I'm using the onLoad event and I'm hiding the main objects till after the java script function runs.
And I also suffer from the same "flicker" issue.
Shlomi

Similar Messages

  • I recently upgraded my Mac to Yosemite and I can't use the custom function (grayed out) in Image Trace Illustrator CS6 (physical version). Anyone else having this issue?

    I recently upgraded my Mac to Yosemite and I can't use the custom function (grayed out) in Image Trace Illustrator CS6 (physical version). Anyone else having this issue?

    Custom will show automatically as soon as you just edit some options. So just go ahead, you don't need to select "custom"

  • How can I use JavaScript extention functions with Xalan for transforming XML with XSL

    While transforming standart XML and XSL files to HTML with this servlet:
    package mypackage1;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.util.*;
    import java.net.URL;
    import javax.xml.transform.*;
    import javax.xml.transform.stream.StreamSource;
    import javax.xml.transform.stream.StreamResult;
    import org.mozilla.javascript;
    public class Servlet2 extends HttpServlet
    private static final String CONTENT_TYPE = "text/html; charset=windows-1252";
    public void init(ServletConfig config) throws ServletException
    super.init(config);
    public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException
    try
    response.setContentType(CONTENT_TYPE);
    PrintWriter out = response.getWriter();
    TransformerFactory tFactory = TransformerFactory.newInstance();
    Source xmlSource = new StreamSource(new FileReader("c:/aaa.xml"));
    Source xslSource = new StreamSource(new FileReader("c:/bbb.xsl"));
    Transformer transformer = tFactory.newTransformer(xslSource);
    transformer.transform (xmlSource, new StreamResult(out));
    catch (Exception e)
    e.printStackTrace();
    everything is going ok,
    but when try to use javascript function in XSL file, for example like in this:
    <?xml version="1.0"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
    xmlns:lxslt="http://xml.apache.org/xslt" xmlns:my-ext="ext1"
    extension-element-prefixes="my-ext">
    <lxslt:component prefix="my-ext"
    functions="getdate">
    <lxslt:script lang="javascript">
    function getdate() {
    var d = new Date();
    return d.toUTCString();
    </lxslt:script>
    </lxslt:component>
    <xsl:template match="/">
    <p><xsl:copy-of select="my-ext:getdate()"/></p>
    </xsl:template>
    </xsl:stylesheet>
    recieve error-message:
    XSL-1000: (Fatal Error) Error while parsing XSL file (Extension function namespace should start with 'http://www.oracle.com/XSL/Transform/java/'.).
    What kind of namespace I should specify?

    Hello, Paul.
    I'm sure you may not use JavaScript as a language for creating XSLT extention functions with Oracle XDK Parser. This is since parser might have JavaScript interpreter to work with JavaScript, but it has not.
    If you need to build any XSLT extention functions you must build them as Java class' static methods.
    After that, you define the usage of the class by mean of namespace declaration as:
    xmlns:your-ns="http://www.oracle.com/XSL/Transform/java/yourpackage.Yourclass"
    (Prefix "http://www.oracle.com/XSL/Transform/java/" may differs if you use non-Oracle XML parser)
    and use class' static method in XSLT:
    <xsl:value-of select="your-ns.staticMethodName(paramsIfAny)"/>
    In your case you may wish to use standard Date class:
    xmlns:date="http://www.oracle.com/XSL/Transform/java/java.util.Date"
    <xsl:value-of select="date:toString(date:new)"/>

  • Trouble with using javascript $s function to populate a page item

    Hello Oracle APEX Community,
    I'm working on a drilldown dashboard page and have been encountering a problem when i try to populate a Text Page Item (hidden or not) using the javascript built in $s function.
    The function works great when the data is a number such as dept_id (even if the field type is varchar). However, trying to pass anything which is a text the process fails, except when a value is hard-coded as a parameter for the function. So for example, I have a chart with counts of constituents by state. I would like to populate (filter) a table based on when you click on a bar for a state without having to submit the page. I'm using dynamic actions and a built in javascript function in the SQL for the chart to accomplish this; but again, it works great when I use a varchar field like the FIPS code (i.e. the FIPS for Texas is '48'), but when I try to populate the page item using the state abbreviation 'TX' (again varchar) it fails.
    Here's an example of code that works:
    SELECT 'javascript:$s("P1_DEPTNO",'||d.deptno||')' LINK,
    d.dname LABEL,
    sum(e.SAL) sal
    FROM emp e, dept d
    where e.deptno = d.deptno
    group by 'javascript:$s("P1_DEPTNO",'||d.deptno||')', d.dname And here's an example of code that does not work:
    SELECT 'javascript:$s("P1_DEPTNO",'||d.loc||')' LINK,
    d.dname LABEL,
    sum(e.SAL) sal
    FROM emp e, dept d
    where e.deptno = d.deptno
    group by 'javascript:$s("P1_DEPTNO",'||d.loc||')', d.dname However, when I hard code a text value the script works:
    SELECT 'javascript:$s("P1_DEPTNO","BOSTON")' LINK,
    d.dname LABEL,
    sum(e.SAL) sal
    FROM emp e, dept d
    where e.deptno = d.deptno
    group by 'javascript:$s("P1_DEPTNO","BOSTON")', d.dname
    ORDER BY d.dname I'm encountering this problem on several versions of APEX: (4.0.2.00.07-local installation) and (4.1.0.00.28-apex.oracle.com)
    Does anybody know of this problem and how to solve it? I've looked for settings on the page item itself, and can't figure it out.
    I've re-written my sql to utilize the value fields of my tables instead but I have some objects on the page which are really going to depend on the character based data instead.
    Thanks,
    Wayne

    In your javascript you are generating, surround your value with double-quotes and it'll should then always work with both numbers and strings (your strings are probably being interpreted as variable names and they don't exist at runtime, hence erroring out).
    Example:
    SELECT 'javascript:$s("P1_DEPTNO","'||d.loc||'")' LINK,Edited by: gti_matt on Aug 16, 2011 9:50 AM

  • How can I decode Japanese character using java from JavaScript escape() function

    Hi:
    I have an application which supports Japanese character. I am using JavaScript escape() function to encode the text field before I posted it through web server and then I will just convert it into hex number to decode it through an Integer. It works fine for the character between ascii 1-255. However, it faild on all the double bytes character. All the unicode has the format of "%uXXXX" after it is escaped from JavaScript. How can I resolve the decoding problem?
    Thank,
    David

    Please use 'encodeURI()', though it is supported only IE after 5.5.
    I'm not sure Netscape.
    Thanks,
    Katsumi
    dwang <[email protected]> wrote:
    Hi:
    I have an application which supports Japanese character. I am using JavaScript
    escape() function to encode the text field before I posted it through
    web server and then I will just convert it into hex number to decode
    it through an Integer. It works fine for the character between ascii
    1-255. However, it faild on all the double bytes character. All the
    unicode has the format of "%uXXXX" after it is escaped from JavaScript.
    How can I resolve the decoding problem?
    Thank,
    David

  • SSRS - Pass Field Value List To Custom Function Assembly And Display Result

    I have written a SQL Server Reporting Services custom function as a C# assembly DLL and added it to my report. The purpose of the function is to search for outlier records in a collection of data. The data is represented as an array of floating point -tuplets
    (float[][]). In a medical patient database, these might be things such as blood pressure, cholesterol, hight, weight, waist measurement, etc.
    Several user input parameters are provided in the report, including numeric seed values for this particular algorithm. One multivalued parameter is a list of the numeric columns to be used as input to the algorithm because, importantly,
    the user can choose any subset of the value columns. I have a tablix that will display columns from the dataset conditionally, based on which of those columns are chosen.
    At this point, there are two issues I'm having difficulty with:
    How do I, in the course of running the report, take just the numeric columns that the user has chosen (ignoring all others in the dataset) and pass them as a float[][] to my custom function? Or is there something in the
    Microsoft.ReportingServices namespace that I should use to query an input dataset and convert it to an array in my C# code?
    How can I present the array subset returned by my custom function in a tablix in the report?
    Note: One thought that occurs to me is that outlier records tablix could be contained in a subreport, but I'm not clear on the logistics of passing dataset field results from a master report to a subreport.
    I envision a final report when run to be similar to the following:
    - Mark Z.

    Hi Mark,
    Sorry for the delay.
    From your description, you want to pass the dataset data to a custom code array, and return the subset of the array, right? In this case, you can use a custom function to add the data to array, and use the a custom function to sort the data base on your
    requirement and then use a function to get the subset of the array. Here are some sample custom code for your reference.
    Add to arryay
    Dim values As System.Collections.ArrayList=New System.Collections.ArrayList()
    Function SetText(ByVal value As Integer) As Integer
        values.Add(value)
        return value
    End Function
    Sort array
    Function Sort()
    Dim i as Integer
    Dim j as Integer
    Dim t as Integer
    Dim n as Integer=values.Count-1
    For i=n To 1 Step-1
     For j=0 To i-1
     if values(j)<values(j+1) Then
        t=values(j)
        values(j)=values(j+1)
        values(j+1)=t
     End if
     Next j
    Next i
    End Function
    Return value.
    Function Rank(ByVal value As Integer)
       return values(value)
    End Function
    Assume that you pass [Weight] field to array, you can use the expression below on the Weight column:
    =Code.SetText(Fields!Weight.Value)
    Then use the expression below to get the values.
    PatientID:=Sort() & Lookup(Code.Rank(0),Fields!Weight.Value,Fields.Patient.Value,"Dataset")
    Height:=Lookup(Code.Rank(0),Fields!Weight.Value,Fields.Height.Value,"Dataset")
    Weight:=Code.Rank(0)
    Hope this helps.
    Regards,
    Charlie Liao
    If you have any feedback on our support, please click
    here.
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • Error in Custom Function Module

    Hi,
    I am working on implementing General Ledger Business content in financial Accounting.
    We had a requirement of creating a Custom Virtual cube similar to 0FIGL_V10. Hence, we had copied the standard function module RS_BCT_FIGL_DATA_GET_VC10 and created a custom function module. Before doing that, we had copied the function group RS_BCT_FIGL and created a custom function group for the custom function module.Both were activated subsequently. Then, we had created a custom virtual cube (ZFIGL_V10) using the custom function module.
    The queries on the Standard virtual cube were migrated to ZFIGL_V10 using the RSZC transaction code. when the queries are executed in RSRT, we get an error message "**An exception with the type CX_SY_DYN_CALL_ILLEGAL_FUNC occurred" and the ABAP debugger is started post that error.
    Has anyone faced this problem before?could any of you provide some pointers to it.
    Regards,
    Sainath

    You cannot use the standard function module which is used for standard cube for another cube.
    You should not change the function module.
    Instead you can make a copy of the function module you are using aand use this copy in ur virtual cube which will work in the same way the actual Fm used to work and it will make you perfrom the changes.
    Follow the below steps:
    1) Goto SE37 and In the top tool bar click on the copy button which is on right side of delete button.
    2) in fr FM give the name of the actual FM and in to Fm give the name of the function module you want to copy.
    3) Then click on copy.
    4) Now open this new function in edit mode and goto the import/export parameters and check. it will have all the same parameters as the actual FM. Here you can make the changes you want.
    5) Now use this FM in your virtual cube and it will be working as per your requirement
    https://forums.sdn.sap.com/click.jspa?searchID=9605118&messageID=4999763
    Hope it Helps
    Chetan
    @CP..

  • Custom function call results in 403 Forbidden error

    Hi,
    I use an custom function to show images from blob columns in a report (as shown in Re: How to Display image, that is stored in database This run fine with Apex 2.2.
    After a new installation on an other server - now with Apex 3.1 - everything is ok, but instead of the images only the broken image is displayed.
    Clicking on "show image" calls this URL http://-bla bla- /pls/htmldb6/UNTERSCHRIFTEN.uv_blob_download?p_file=1002401114659435
    and results in this error:
    You don't have permission to access /pls/htmldb6/UNTERSCHRIFTEN.uv_blob_download on this server.
    On the same Installation the sample application runs fine, also the images are displayed correctly. Also the "show image" call http://- bla bla -/pls/htmldb6/apex_util.get_blob_file?a=103&s=805871757194874&p=6&d=476144746179567984&i=176988523388974647&p_pk1=1&p_pk2=&p_ck=DE4CD5C7A077B26C18DDBF429D62F8D5
    works correct.
    I think there is something wrong with some settings.
    Any ideas?
    Thanks for your help,
    Frank

    Hello Vidar,
    I got it: The solution is in wwv_flow_epg_include_mod_local
    I had to put my function in here.
    See also: http://daust.blogspot.com/2006/04/xe-calling-stored-procedures.html
    or in my blog: (in german) http://frankschmidt.blogspot.com/2008/07/apex-blob-direkt-im-report-anzeigen.html
    Thank's for you ideas!
    Regards,
    Frank

  • Custom Function Help

    Post Author: edy80y
    CA Forum: Formula
    I have a report with many subreports which all contain the same formula to group teams.When a new team is added i need to update all instances of the formula so they are all up to date.I know of Custom Function so i created one out of the formula in the main report.  The problem im finding is that im unable to use that custom function in the sub reports.Am i wring in thinking that a custom function created in a main report can be used in its sub reports??Am i creating the custom function incorrectly? Heres what i have done:
    Our database has team names that have a prefix of the State they are in such as: Perth - Team Orange Perth - Team Apple Sydney - Team Grape Sydney - Team Pineapple
    At one stage the Teams in Perth had been split into Perth1 and Perth2 resulting in the following records in the database:
    Perth1 - Team Orange Perth - Team Orange
    Because of this i have created a formula that groups teams into sites:
    select Trimleft(mid({team.name},instr({team.name},'-')+1))case 'Team Orange', 'Team Apple': 'Perth'case 'Team Grape', 'Team Pineapple': 'Sydney'default:''
    I use this formula in all reports and subreports and i link by them as well, so if a new team is created (for example Perth - Team Pear) i need toupdate all instances of the formula by adding 'Team Pear' to the Perth case.
    To fix the problem i created a custom function (called 'site') out of the formula above and it created this:
    Funtion (stringvar v1)select Trimleft(mid(v1,instr(v1,'-')+1))case 'Team Orange', 'Team Apple': 'Perth'case 'Team Grape', 'Team Pineapple': 'Sydney'default:''
    Now within that main report i am able to go to the formula editor and when i type site() then wording becomes blue but when i go into a sub report to do the same it doesnt react.
    I hope i have explained my self well enough for you to understand my predicament without boring you.
    Thanks in advance for your help!

    Post Author: edy80y
    CA Forum: Formula
    Hi,
    Thanks for the reply.  Unfortunately it does make things easy for me.  If i add the custom function in the subreport then i will have to updae that as well whenever a new team is created.  I'm looking for a solution where i only have to update the custom function in the main report only and not in the 7 or 8 subreports within it.
    Unless i am doing something wrong.  I basically copied the contecnt of the Custom Function in the main report and then went into the sub report and created a new Custom Function and pasted the code in it.
    Regards,
    Eddie S

  • Combination of Custom Functions

    I use a Custom Function (Length) to determine the length of a text attribute. But for some reason in RuleBurst (9.4) it is not possible to combine more Custom Functions in 1 conclusion. The syntax TotalLength = Length("A") + Length("B") is accepted , but in the debugger I get the error "System.NullReferenceExeption: Object not set to an instance of an object".
    Is this in principle not possible or did I make an mistake in the description or development of the Cusom Function?
    Cheers, Pierre

    It sounds like you are using the 'extensions' method of building a custom function. Here's a couple of things to try:
    - make sure the parameter to the function is an attribute rather than a constant string. I can't recall if this is a definite limitation but I know it should work with an attribute so try that.
    - does it work when you use the 'generic' custom function calling method, ie. Number(CallCustomFunction("Length", "stringattr")) ?
    - 9.4 is an old version now, any particular reason you aren't using 10.1?

  • Adding Custom Dictionary using Javascript

    Hi All,
    We have created a javascript to spellcheck the PDF using the inbuilt dictionary.
    Now we got a request to add a custom Medical dictionary to Adobe Acrobat.
    Is that possible to add a custom dictionary to Adobe Acrobat using Javascript.
    I have gone through the "Javascript for Adobe API Reference.pdf".
    But there is no reference for adding a full set of dictionary to it.
    spell.customDictionaryCreate("javascript", "en", true);
    function GetJSTerms(bm, nLevel) { var newWord = bm.name.match(re);
    var ckWord = spell.checkWord( newWord[0] );
    if ( ckWord != null ) { var cWord = spell.addWord( newWord[0], "JavaScript");
    if ( cWord ) console.println( newWord[0] );
    } if (bm.children != null) for (var i = 0; i < bm.children.length; i++) GetJSTerms(bm.children[i], nLevel + 1);
    } console.println("\nAdding New words to the \"JavaScript\" " + "dictionary:");
    var re = /^\w+/; GetJSTerms(this.bookmarkRoot, 0);
    Would this task is achievable through javascript, please advice.
    Shaji

    Thank for the response. We have a medical dictionary with us. Which contains all the words, how do I add the full dictionary with the addWord functionality. Is there is any option to load the dictionary file through scripting. Shaji

  • How to pass value to pop up window using javascript function?

    I am not sure how to do this, I want to open new window from existing form,This is Mod/PLsql for consists some javascript functions also. When I am clicking on new window in form then new form should open with results of value entered,but new window form is opening with main page :( , not able to get text box value from parent form. How to call textbox input value in popup window from parent window using javascript?
    currently I'm using following code:
    HTP.p('<script type="text/javascript">
    function pop_up5()
    var l_url=window.opener.document.getElementById("p_single_store_pc").value;
    window.open(l_url, '''', ''fullscreen=no, scrollbars=1'');
    </script>' );
    Edited by: user11970612 on Jun 14, 2012 5:02 AM

    this is probably due to the Javascript code and not a "real link" to another page... I don't know if the null is due to the Javascript...
    But if you really really want to use javascript instead of a ... you can pass the location of the url with JSP (on your main page) as a parameter to the open window... (...) u can put instead of main.jsp <%= request.getServerName()+request.getRequestURI() %>
    the value <%= ... %> will return something like test.com/html/main.jsp
    Hope this helps.

  • Inconsistent Errors when processing  IDocs using custom Function Module

    I am encountering a most perplexing error. Here is the situation.
    We have a custom function module to update data in the EH&S system. We are having a bizarre error occurring. This is the basic processing of the function module:
    1. IDoc data is read and loaded into an internal table.
    2. Data is run through a series of checks to determine if the data is valid for entry into the system.
    3. After validation we use function module  C1F2_SUBSTANCES_READ_WITH_REF to read  characteristic data for the  substance. This data is used to validate whether current data exists to allow for loading of the IDoc data. (This is the step where the IDoc is receiving an error even if the data is valid. This only occurs if we are processing a large amount of Idocs and one IDoc contains valid data and another invalid data for the same substance. It occurs even if the Idocs are not processed in sequence.  If individually processed or reprocessed after initial failure they pass. This is what is so confusing!) If it exists, a flag is set and  the data is loaded using function module BAPI_BUS1077_CHANGE to modify the data.
    4. If the flag is set to allow further processing, the function module C1F2_SUBSTANCES_READ_WITH_REF is used again to select different characteristic data for the substance. A similar validation process occurs and if it passes, data is loaded using BAPI_BUS1077_CHANGE to update and BAPI_BUS1077_CREATE to create new data.
    Here is the situation:
    When processing one valid record for one substance, the record loads successfully.  When processing multiple valid records (all are valid) for one substance, they all load successfully.  The problem occurs when attempting to load valid and invalid records for the same substance.  Some times the program successfully loads the valid data (as expected).  Other times, it will not load any records.  It is not consistent!
    The order of IDoc processing does not have an impact on the success of the load.  Whether the valid or invalid record processes first does not have an impact on the success of the valid substance load.
    Does anyone have ANY Idea of what is going on? I am clearing all fields in the function module before processing occurs. I cannot find what is causing the error to occur.
    HELP!
    Jim Hardy

    I have some further information. It seems that if data for a substance is sent in two separate Idocs, one with valid and one with invalid data, As long as the two IDocs are processed consecutively, they process correctly. If they are separated by IDocs containing other substance information, they fail.
    thanks
    Jim

  • Using javascript to call a signed applet's read/write functions problem.

    Hi, I wan't to use javascript to call the read/write functions of my signed java applet.
    The applet can read/write fine, if its called from inside the applet, but when I make public functions to do the read/write and then call those functions from javascript, i get the old security exception.
    Has anyone done this before?
    Thanks

    From what I understand is that for example file IO can only be done if the current method
    has this privilege and the stack that called the current method had this privilege.
    Javascript doesn't have any privilege and calling methods that do file IO directly from
    javascript should not work, this bug was fixed in 1.4.2.
    The workarround AccessController.doPrivileged(new PrivilegedAction() { might allso be
    fixed in later versions since changing the privileges of currently executing code is
    someting that should not be possible when the currently executing code is called from
    "untrusted" (javascript) code.
    http://forum.java.sun.com/thread.jsp?forum=63&thread=524815
    second post

  • How to export book pdf using custom presets for all book files in indesign using javascript

    How to export book pdf using custom presets for all book files in indesign using javascript.

    Hi jackkistens,
    Try the below js code.
    Note: you can change your preset name in below (e.g, Your preset name).
    var myBook = app.activeBook;
    myBook.exportFile(ExportFormat.PDF_TYPE, File (myBook.filePath+"/"+myBook.name.replace(/\.indb/g, ".pdf")), false, "Your preset name", myBook.bookContents, "Book_PDF", false);
    example:
    var myBook = app.activeBook;
    myBook.exportFile(ExportFormat.PDF_TYPE, File (myBook.filePath+"/"+myBook.name.replace(/\.indb/g, ".pdf")), false, "[High Quality Print]", myBook.bookContents, "Book_PDF", false);
    thx,
    csm_phil

Maybe you are looking for

  • A Way To Compare iPod to iTunes?

    We have over 20,000 songs on iTunes when we update our iPod there are 131 songs that are not loading onto the iPod. These are not missing files. Is there any easy way to compare what is on the iPod to what is on iTunes without having to go through ev

  • 27 inch imac when reset is press nothing happens

    When I press the reset icon my imac show the revolving icon on the screen but this continues until I do a manual reset. Any ideas of why this is occuring?

  • Problem in rendering dashboard

    Hello, Here is a screenshot of my dashbord. I think there is some rendering issue. Can anyone help me with this. Thanks

  • Movieclip loader question

    Hi, I just used the movie clip loader class to load a swf dynamically, and oddly, the width and height are zero even as i'm looking at the loaded clip too large for the area i'm loading it into. Is there any way around this? thanks e

  • Editing AVCHD in Premiere Pro using laptop.  How to assign functions?

    We are about to purchase a fast gaming laptop computer with i7 quad core CPU and at least 8 gB of RAM. We will install our copy of CS5.5, with primary application being Premiere Pro. Being able to move the computer from place to place easily is very