Is it possible to load a user defined mathscript function at run-time in an executable?

I am currently allowing a customer to define their own matlab script for post-processing their data file. This is all well and good in the development environment, beecause when I re-load this VI, it searches my MathScript search paths and re-loads the .m file if it has changed. However I am noticing that when doing a build to an exe the MathScript node seems to be compiled from the file as it is at build time.
Is there anyway to avoid this? Can I programatically call the MathScript function such that it does the search at run-time? Any ideas would be much appreciated.

Hey,
How are you including the .m file? Do you think you could post a screen shot of your code?
Thanks
Britton C.
Applications Engineer
National Instruments

Similar Messages

  • Can I call a User-Defined Mathscript Function using LabVIEW 7.1?

    I am trying to use a User-Defined function call in a mathscript node using LabVIEW 7.1 and I cannot seem to make it work.
    For example, consider that my mathscript node contains:
    clear all;
    close all;
    x = linspace(1,100,5);
    y = mltp(x);
    where the labview vi is saved in the same folder as the mathlab script mltp.m that is given by:
    function out1 = mltp(in1)
    out1 = 5*in1;
    Creating an array output of the mathscript node for y yields an empty array.
    How can I use User-Defined functions in a mathscript node using LabVIEW 7.1?

    Hello,
    LabVIEW 8.2 did not yet have the MathScript page in Tools >> Options.  In this version, you need to set the search path through the MathScript Window.  Launch the window from Tools >> MathScript Window.  Then go to File >> MathScript Preferences.  It sounds like you have done this.
    A first guess is that your .m file calls some unsupported functions or uses unsupported syntax.  If that were the case, you could put the script in the Script Editor of the MathScript Window and select the "Save and Compile Script" menu item.  This will return any errors from compiling the script.  However, you said you simplified the problem to a single multiplication.  Since this still does not work, I need more information.  What are all the directories listed for the path in the MathScript Preferences dialog from the MathScript window?  What is the working directory?  Where is your .m file located on disk?  Can you attach your .m file or paste the contents in your message?
    Grant M.
    Staff Software Engineer | LabVIEW Math & Signal Processing | National Instruments

  • User defined spoolfile name at run time.

    Hi all,
    What I want to run in SQLPlus is
    PROMPT Enter a spoolfile name
    SPOOL &SpFile
    SELECT * FROM Scott.emp
    SPOOL OFF
    When I run this as a script - i.e. @foo.sql, it works fine - i.e. it prompts the
    user for a name for the SpFile. However, when I copy and paste the text into
    SQLPlus and try and run it, it fails - it runs through the PROMPT/SPOOL bit
    of the script with the message
    apps@WHITE> SPOOL &SpFile;
    Enter value for spfile:
    not spooling currently
    apps@WHITE>
    and produces no output. If I put SPOOL '&SpFile'; it produces a file
    called ''.lst - yes two single quotes.lst.
    Can anyone explain what is going on and how I can get the
    behaviours to match in the interactive and batch modes?
    TIA.
    Paul...

    SQL> spool off
    SQL> spool &a
    Enter value for a: c:\abc.txt
    SQL> select count(*) from user_objects where
    rownum<=1;Thanks for your interest, but you have slightly misunderstood me.
    It will work fine if I have the spool &xyz in my_script.sql and then do
    SQL> @my_script
    but it does not* work if I copy and paste the contents of my_script.sql
    at the SQL> prompt - i.e. all in one go.
    This puzzles me, because it works fine if I copy and paste a multiline sql
    statement which has an & in the SELECT part of the statement. I think it's
    related to an issue I noticed recently whereby if you copy and paste an
    SQL script into the buffer which contains non-SQL (i.e. column blah format a30),
    for example, SQLPlus throws an error when you try to run what's in the
    edit buffer by typing / and return.
    This is why I started copying and pasting at the prompt in the first place,
    but this is the first time I've tried to input a "non-SQL" variable name in
    this fashion.
    This is where I'm having the issue. Hope this is clearer now.
    Paul...

  • Is it possible to add a user to a role at run-time?

    basically I need to be able to add a user to a role programmatically before the role-based content is displayed to the user.
    Example: I have a role called 'Manager' created in the portal. When a user logs on, I detect that the user has the attribute 'job title' = 'Manager' so I add the user to the 'Manager' role and the portal shows the content for the 'Manager' role.

    Hi Umesh,
    The assigning and unassigning of the users from the roles can be made dynamic using the IRole, IRoleFactory API's. The Blog below explains how users can be assigned or unassigned to a role programatically.
    Restricting usage of iViews and Pages
    Make some modifications to fit your requirement....
    Hope this helps.
    Regs,
    jaga

  • User-Defined Aggregate Function in oracle

    Somebody knows if in oracle 10g is possible to create a User-Defined Aggregate Function?
    Sometingh like my_sum, that aggregate the values in a way that i want...
    select manager, my_sum(salary)
    group by manager
    In internet i've found rellay notingh for oracle 10g...can somebody help me? Thank's in advance!

    Thank's to everybody!!! I've made my custom function sum_distinct
    create or replace type AggregateCD as object
    (  nb                   number,
         ListOfDistinctValue  clob,
        static               function ODCIAggregateInitialize(sctx IN OUT AggregateCD) return number,
        member               function ODCIAggregateIterate(self IN OUT AggregateCD, value IN VARCHAR2) return number,
         member               function ODCIAggregateTerminate(self IN AggregateCD, returnValue OUT number, flags IN number) return number,
        member               function ODCIAggregateMerge(self IN OUT AggregateCD, ctx2 IN AggregateCD) return number
    create or replace type body AggregateCD is
       static function ODCIAggregateInitialize(sctx IN OUT AggregateCD) return number is
         begin
             sctx := AggregateCD(0,null);
             return ODCIConst.Success;
        end;
        member function ODCIAggregateIterate(self IN OUT AggregateCD, value IN VARCHAR2) return number is
            ListOfValue CLOB:=self.ListOfDistinctValue ;
         begin
             self.nb:=self.nb+to_number(substr(value , INSTR(value, ';', 1, 1)+1 ,length(value)));
            return ODCIConst.Success;
        end;
        member function ODCIAggregateTerminate(self IN AggregateCD, returnValue OUT number, flags IN number) return number is
         begin
              returnValue := self.nb;
              return ODCIConst.Success;
        end;
         member function ODCIAggregateMerge(self IN OUT AggregateCD, ctx2 IN AggregateCD) return number is
         begin
             self.nb := ctx2.nb;
             return ODCIConst.Success;
        end;
      end;
    CREATE OR REPLACE FUNCTION sum_distinct (input VARCHAR2) RETURN number
      PARALLEL_ENABLE AGGREGATE USING AggregateCD;you can use so:
    select sum_distinct(distinct t.primary_key||';'||t.import)
    from table1 t, table2_with_bad_join
    it's the same of
    select sum(t.import)
    from table 1

  • Loading the user defined class file

    Hai,
    Is there any way to load the user defined class at the time of starting my Jakarta Tomcat server.
    Regards
    ackumar

    Hi!!
    Hope, <load-on-startup> tag of web.xml helps in
    s in this regard.I think this tag is to load servlet. I am talking about loading a user defined class file for example xyz.class which is no a servlet just a class file.
    Regards
    ackumar

  • How can I call a stateful webservice from a user-defined XPath function?

    I'm calling a stateful webservice from a BPEL process using a PartnerLink which implements Custom Header Handler classes to handle the session state, storing the cookie as a property of the PartnerLink.
    I'd also like to call this same stateful webservice, in the same session, from a user-defined XPath function enabling me to call this from an XSL Transformation.
    Is this in any way possible? Can I access the cookie and attach it to the webservice call made by the user-defined XPath function?

    Actually, as long as the servlet returns valid javascript, you can indeed "call it" from the client. It will initiate a request and return the result to the browser.
    This example uses Perl, but it could be easily modified to go to a servlet instead.
    Note that it is only supported in DOM browsers (IE6+/NN6+/etc)
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
    <html>
    <head>
    <title> Test server-side JS </title>
    </head>
    <body>
    <script type="text/javascript">
    function checkIt(variable, value)
    var newScript = "cgi-bin/validateJS.cgi?"+variable+"="+value;
    var body = document.getElementsByTagName('body').item(0)
    var scriptTag = document.getElementById('loadScript');
    if(scriptTag) body.removeChild(scriptTag);
    script = document.createElement('script');
    script.src = newScript;
         script.type = 'text/javascript';
         script.id = 'loadScript';
         body.appendChild(script)
    </script>
    <p>Test.</p>
    <form id="f1" action="">
    <input type="text" name="t1" id="t1" onChange="checkIt(this.name, this.value)">
    </body>
    </html>
    validateJS.cgi
    #!/opt/x11r6/bin/perl
    use CGI qw(:all);
    my @valArray = split(/=/,$ENV{QUERY_STRING});
    print "Content-type: text/javascript\n\n";
    # myPass is the password
    $myPass = "foobar";
    if ("$valArray[1]" eq "$myPass")
    print "alert(\"Success!!\")";
    else
    print "alert(\"Failure!!\")";

  • PL/SQL : User defined Aggregate Functions ??

    Is it possible to create (using whatever language) a user defined aggregate function for transparent usage within sql ?
    e.g.
    select median(myField) from myTable
    or
    select empirical_expectation(myField) from myTable
    thanx in advance ..
    Tobias Oberstein

    HI,
    U can create a stored proc. (PL/SQL) for this and call as any other function.
    By using external procedure, U can create shared library in C or C++ and coonect this shared library by using external function/procedure. This will be become user-defined procedure.
    with regards,
    Boby Jose Thekkanath.

  • How can I use User-Defined Aggregate Functions in Timesten 11? such as ODCI

    Hi
    we are using Timesten 11 version and as per the documentation, it doesn't support User-Defined Aggregate Functions.
    So we are looking for alternatives to do it. Could you please provide your expert voice on this.
    Thanks a lot.
    As the following:
    create or replace type strcat_type as object (
    cat_string varchar2(32767),
    static function ODCIAggregateInitialize(cs_ctx In Out strcat_type) return number,
    member function ODCIAggregateIterate(self In Out strcat_type,value in varchar2) return number,
    member function ODCIAggregateMerge(self In Out strcat_type,ctx2 In Out strcat_type) return number,
    member function ODCIAggregateTerminate(self In Out strcat_type,returnValue Out varchar2,flags in number) return
    number
    How can I use User-Defined Aggregate Functions in Timesten 11? such as ODCIAggregateInitialize ?

    Dear user6258915,
    You absolutely right, TimesTen doesnt support object types (http://docs.oracle.com/cd/E13085_01/doc/timesten.1121/e13076/plsqldiffs.htm) and User-Defined Aggregate Functions.
    Is it crucial for your application? Could you rewrite this functionality by using standart SQL or PL/SQL?
    Best regards,
    Gennady

  • XSLT Mapping - user defined Extension function

    Hi to all,
    can somebody helps me, please?
    I need an own function, that can be used by the XSL Mapper. First I have only tried the sample given in Path <BPELPM>\integration\orabpel\samples\demos\XSLMapper\ExtensionFunctions
    There is a java file with the defined functions and a xml file with the definition of this function for the mapper and last but not least a jar-file with the java class.
    I have copied the jar to <JDEV_HOME>\jdev\lib\ext directory and in JDeveloper I have added SampleExtensionFunctions.xml to Tools->Preferences->XSL Map -> "User Defined Extension Functions Config File" field. After a restart of JDeveloper I find 2 new functions in the "User Defined Extension Functions" component palette page when a XSL Map is open. That's fine.
    But if I test the mapping I get an error: "Failed to transform source XML.
    java.lang.NoSuchMethodException: For extension function, could not find method org.apache.xpath.objects.XNodeSet.replaceChar([ExpressionCotext,]#STRING, #STRING)."
    What is wrong?
    Thanks in advance of your answer
    best regard,
    uno

    Oracle XML support Extension function.
    For example:
    If we would like to import FAQDBUri.class with user-defined java functions, like TranslateDBUri(), we can write XSL file like this:
    <xsl:template match="/" xmlns:dburig="http://www.oracle.com/XSL/Transform/java/FAQDBuri">
    <xsl:variable name="urladd" select="dburig:TranslateDBUri($url)"/>

  • User defined xquery function with index enabled

    If I use user defined xquery function, can the index be applied within the function?
    trados.xsd
    <?xml version="1.0" encoding="UTF-8"?>
    <!-- edited with XMLSpy v2005 rel. 3 U (http://www.altova.com) by () -->
    <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" xmlns:tns="http://ecoit.hp.com/ecg/repository/trados" targetNamespace="http://ecoit.hp.com/ecg/repository/trados" elementFormDefault="qualified">
         <complexType name="entry">
              <sequence>
                   <element name="base" type="string"/>
                   <element name="translation" maxOccurs="unbounded">
                        <complexType>
                             <simpleContent>
                                  <extension base="string">
                                       <attribute name="lang"/>
                                  </extension>
                             </simpleContent>
                        </complexType>
                   </element>
              </sequence>
              <attribute name="xpath" type="string" use="required" xdb:SQLName="XPATH"/>
              <attribute name="locator" type="string" use="required"/>
         </complexType>
         <simpleType name="languages">
              <list itemType="string"/>
         </simpleType>
         <element name="trados" xdb:defaultTable="ECG_REP_TRADOS_TAB" xdb:tableProps="VARRAY XMLDATA.ENTRY STORE AS TABLE ECG_REP_TRADOS_ENTRY_TAB ((PRIMARY KEY (NESTED_TABLE_ID, SYS_NC_ARRAY_INDEX$)) ORGANIZATION INDEX OVERFLOW)">
              <complexType>
                   <sequence>
                        <element name="entry" type="tns:entry" minOccurs="0" maxOccurs="unbounded" xdb:SQLName="ENTRY"/>
                   </sequence>
                   <attribute name="cid" type="string"/>
                   <attribute name="path" type="string"/>
                   <attribute name="lang" type="string"/>
                   <attribute name="langs" type="tns:languages"/>
                   <attribute name="oldversion" type="string"/>
              </complexType>
         </element>
    </schema>
    CREATE INDEX ECG_REP_ENTRY_XPATH_IDX ON ECG_REP_TRADOS_ENTRY_TAB ("XPATH", "NESTED_TABLE_ID")
    eco_category.xsd
    <?xml version="1.0" encoding="UTF-8"?>
    <!-- edited with XMLSpy v2008 (http://www.altova.com) by Jan-Erik Pedersen (HEWLETT PACKARD) -->
    <!--W3C Schema generated by XMLSpy v2007 (http://www.altova.com) by Scott Dismukes (Hewlett Packard)-->
    <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" xmlns:tns="http://ecoit.hp.com/ecg/repository/eco/category" xmlns:cns="http://ecoit.hp.com/ecg/repository/types" targetNamespace="http://ecoit.hp.com/ecg/repository/eco/category" elementFormDefault="qualified">
         <import namespace="http://ecoit.hp.com/ecg/repository/types" schemaLocation="../types.xsd"/>
         <complexType name="productFamilies">
              <sequence>
                   <element name="productFamily" type="tns:productFamily" minOccurs="0" maxOccurs="unbounded"/>
                   <element name="product" type="tns:product" minOccurs="0" maxOccurs="unbounded"/>
              </sequence>
              <attribute name="lang" use="required" xdb:SQLName="LANG">
                   <simpleType>
                        <restriction base="string">
                             <length value="5"/>
                        </restriction>
                   </simpleType>
              </attribute>
              <attribute name="version" use="required" xdb:SQLName="VERSION">
                   <simpleType>
                        <restriction base="string">
                             <maxLength value="100"/>
                        </restriction>
                   </simpleType>
              </attribute>
         </complexType>
         <complexType name="productCategory">
              <sequence>
                   <element name="label" type="cns:label"/>
                   <element name="productCategory" type="tns:productCategory" minOccurs="0" maxOccurs="unbounded" xdb:defaultTable="ECG_REP_ECO_CATALOG_PC_TAB"/>
                   <element name="product" type="tns:product" minOccurs="0" maxOccurs="unbounded"/>
              </sequence>
              <attribute name="id" type="cns:id" use="required"/>
         </complexType>
         <complexType name="productCategories">
              <sequence>
                   <element name="productCategory" type="tns:productCategory" minOccurs="0" maxOccurs="unbounded"/>
              </sequence>
         </complexType>
         <complexType name="column">
              <sequence>
                   <element name="label" type="cns:label"/>
              </sequence>
              <attribute name="id" type="cns:id" use="required"/>
         </complexType>
         <complexType name="product">
              <sequence>
                   <element name="label" type="cns:label"/>
                   <element name="column" type="tns:column" minOccurs="0" maxOccurs="unbounded"/>
              </sequence>
              <attribute name="id" type="cns:id" use="required"/>
         </complexType>
         <complexType name="productFamily">
              <sequence>
                   <element name="label" type="cns:label"/>
                   <element name="image" type="cns:image" minOccurs="0" maxOccurs="unbounded"/>
                   <element name="link" type="cns:link" minOccurs="0" maxOccurs="unbounded"/>
                   <element name="column" type="tns:column" minOccurs="0" maxOccurs="unbounded"/>
                   <element name="productCategories" type="tns:productCategories" minOccurs="0" maxOccurs="unbounded"/>
              </sequence>
              <attribute name="id" type="cns:id" use="required"/>
         </complexType>
         <element name="productFamilies" type="tns:productFamilies" xdb:defaultTable="ECG_REP_ECO_CATALOG_TAB"/>
    </schema>
    xquery
    xquery version "1.0";
    declare namespace typ = "http://ecoit.hp.com/ecg/repository/types";
    declare namespace c = "http://ecoit.hp.com/ecg/repository/eco/category";
    declare namespace t = "http://ecoit.hp.com/ecg/repository/trados";
    declare variable $c := $res/c:productFamilies;
    declare function local:pc($pc as element(c:productCategory), $x as xs:string) as element()
         <c:productCategory id="{$pc/@id}">
              <c:label>{data($es/t:entry[@xpath eq concat($x, "/label")]/t:translation)}</c:label>
              for $p in $pc/c:product
              return local:p($p, concat($x, "/product/[@id=", $p/@id, "]"))
              for $pcc in $pc/c:productCategory
              return local:pc($pcc, concat($x, "/productCategory[@id=", $pcc/@id, "]"))
         </c:productCategory>
    declare function local:p($p as element(c:product), $x as xs:string) as element()
         <c:product id="{$p/@id}">
              <c:label>{string($es/t:entry[@xpath eq concat($x, "/label")]/t:translation)}</c:label>
              for $col in $p/c:column
              return
              <c:column id="{$col/@id}">
                   <c:label>
                        let $e := $es/t:entry[@xpath eq concat($x, "/column[@id=", $col/@id, "]/label")]
                        return
                        if(exists($e)) then string($e/t:translation)
                        else $col/c:label/text()
                   </c:label>
              </c:column>
         </c:product>
    <c:productFamiles xsi:schemaLocation="http://ecoit.hp.com/ecg/repository/eco/category http://ecoit.hp.com/ecg/repository/eco/category.xsd http://ecoit.hp.com/ecg/repository/types http://ecoit.hp.com/ecg/repository/types.xsd" lang="{$lang/lang/text()}" version="{$c/@version}">
         for $pf in $c/c:productFamily
         let $x := concat("/productFamily[@id=", $pf/@id, "]")
         return
         <c:productFamily id="{$pf/@id}">
    (:xpath index can not be applied within function:)
              <c:label>{data($es/t:entry[@xpath eq concat($x, "/label")]/t:translation)}</c:label>
              for $img in $pf/c:image
              return $img
              for $link in $pf/c:link
              return $link
              for $col in $pf/c:column
              return
              <c:column id="{$col/@id}">
                   <c:label>{data($es/t:entry[@xpath eq concat($x, "/column[@id=", $col/@id, "]/label")]/t:translation)}</c:label>
              </c:column>
              for $pcs in $pf/c:productCategories
              return
              <c:productCategories>
                   for $pc in $pcs/c:productCategory
                   return local:pc($pc, concat($x, "/productCategories/productCategory[@id=", $pc/@id, "]"))
              </c:productCategories>
         </c:productFamily>
         for $p in $c/c:product
         return local:p($p, concat("/product[@id=", $p/@id, "]"))
    </c:productFamiles>
    Message was edited by:
    John Lee

    John
    Am i missing a bit of the Xquery
    In 11.1,0.6.0 I get
    Elapsed: 00:00:00.04
    SQL> set echo on
    SQL> spool testcase.log
    SQL> --
    SQL> connect sys/ as sysdba
    Enter password:
    Connected.
    SQL> set define on
    SQL> set timing on
    SQL> --
    SQL> define USERNAME = HPECO
    SQL> --
    SQL> def PASSWORD = HPECO
    SQL> --
    SQL> def USER_TABLESPACE = USERS
    SQL> --
    SQL> def TEMP_TABLESPACE = TEMP
    SQL> --
    SQL> drop user &USERNAME cascade
      2  /
    old   1: drop user &USERNAME cascade
    new   1: drop user HPECO cascade
    User dropped.
    Elapsed: 00:00:18.12
    SQL> grant create any directory, drop any directory, connect, resource, alter session, create view to &USERNAME identified by &PASSW
    ORD
      2  /
    old   1: grant create any directory, drop any directory, connect, resource, alter session, create view to &USERNAME identified by &P
    ASSWORD
    new   1: grant create any directory, drop any directory, connect, resource, alter session, create view to HPECO identified by HPECO
    Grant succeeded.
    Elapsed: 00:00:00.03
    SQL> alter user &USERNAME default tablespace &USER_TABLESPACE temporary tablespace &TEMP_TABLESPACE
      2  /
    old   1: alter user &USERNAME default tablespace &USER_TABLESPACE temporary tablespace &TEMP_TABLESPACE
    new   1: alter user HPECO default tablespace USERS temporary tablespace TEMP
    User altered.
    Elapsed: 00:00:00.00
    SQL> connect &USERNAME/&PASSWORD
    Connected.
    SQL> --
    SQL> alter session set events ='19027 trace name context forever, level 0x800'
      2  /
    Session altered.
    Elapsed: 00:00:00.00
    SQL> --
    SQL> declare
      2    xmlschema xmltype := XMLTYPE(
      3  '<?xml version="1.0" encoding="UTF-8"?>
      4  <!-- edited with XMLSpy v2008 (http://www.altova.com) by Jan-Erik Pedersen (HEWLETT PACKARD) -->
      5  <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" xmlns:tns="http://ecoit.hp.com/ecg/rep
    ository/types" targetNamespace="http://ecoit.hp.com/ecg/repository/types" elementFormDefault="qualified">
      6     <complexType name="item">
      7             <simpleContent>
      8                     <extension base="tns:content">
      9                             <attribute name="id" type="tns:id" use="required"/>
    10                     </extension>
    11             </simpleContent>
    12     </complexType>
    13     <complexType name="items">
    14             <sequence>
    15                     <element name="item" type="tns:item" maxOccurs="unbounded"/>
    16             </sequence>
    17             <attribute name="id" type="tns:id" use="required"/>
    18     </complexType>
    19     <complexType name="mappings">
    20             <sequence>
    21                     <element name="item" type="tns:item" minOccurs="0" maxOccurs="unbounded"/>
    22                     <element name="items" type="tns:items" minOccurs="0" maxOccurs="unbounded"/>
    23             </sequence>
    24     </complexType>
    25     <complexType name="local">
    26             <sequence>
    27                     <element name="common">
    28                             <complexType>
    29                                     <sequence>
    30                                             <element name="texts" type="tns:mappings"/>
    31                                             <element name="images" type="tns:mappings" minOccurs="0"/>
    32                                     </sequence>
    33                             </complexType>
    34                     </element>
    35                     <element name="section" minOccurs="0" maxOccurs="unbounded">
    36                             <complexType>
    37                                     <sequence>
    38                                             <element name="texts" type="tns:mappings"/>
    39                                             <element name="images" type="tns:mappings" minOccurs="0"/>
    40                                     </sequence>
    41                                     <attribute name="id" use="required">
    42                                             <simpleType>
    43                                                     <restriction base="string">
    44                                                             <maxLength value="32"/>
    45                                                     </restriction>
    46                                             </simpleType>
    47                                     </attribute>
    48                             </complexType>
    49                     </element>
    50             </sequence>
    51             <attribute name="lang" use="required" xdb:SQLName="LANG">
    52                     <simpleType>
    53                             <restriction base="string">
    54                                     <length value="5"/>
    55                             </restriction>
    56                     </simpleType>
    57             </attribute>
    58     </complexType>
    59     <complexType name="link">
    60             <sequence>
    61                     <element name="url" type="tns:url"/>
    62                     <element name="label" type="tns:label"/>
    63                     <element name="image" type="tns:image" minOccurs="0"/>
    64             </sequence>
    65             <attribute name="id" type="tns:id"/>
    66     </complexType>
    67     <complexType name="image">
    68             <sequence>
    69                     <element name="url" type="string"/>
    70                     <element name="label" type="tns:label" minOccurs="0"/>
    71             </sequence>
    72             <attribute name="id" type="tns:id" use="optional"/>
    73     </complexType>
    74     <simpleType name="id">
    75             <restriction base="string">
    76                     <maxLength value="100"/>
    77             </restriction>
    78     </simpleType>
    79     <simpleType name="label">
    80             <restriction base="string">
    81                     <maxLength value="200"/>
    82             </restriction>
    83     </simpleType>
    84     <simpleType name="content">
    85             <restriction base="string">
    86                     <maxLength value="4000"/>
    87             </restriction>
    88     </simpleType>
    89     <simpleType name="url">
    90             <restriction base="string">
    91                     <maxLength value="256"/>
    92             </restriction>
    93     </simpleType>
    94  </schema>');
    95  begin
    96    dbms_xmlschema.registerSchema
    97    (
    98        schemaurl => 'http://ecoit.hp.com/ecg/repository/types.xsd'
    99       ,schemadoc => xmlschema
    100       ,local     => TRUE
    101       ,genBean   => false
    102       ,genTypes  => TRUE
    103       ,genTables => TRUE
    104       ,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
    105    );
    106  end;
    107  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:01.35
    SQL>
    SQL> declare
      2    xmlschema xmltype := XMLTYPE(
      3  '<?xml version="1.0" encoding="UTF-8"?>
      4  <!-- edited with XMLSpy v2005 rel. 3 U (http://www.altova.com) by  () -->
      5  <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" xmlns:tns="http://ecoit.hp.com/ecg/rep
    ository/trados" targetNamespace="http://ecoit.hp.com/ecg/repository/trados" elementFormDefault="qualified">
      6     <complexType name="entry">
      7             <sequence>
      8                     <element name="base" type="string"/>
      9                     <element name="translation" maxOccurs="unbounded">
    10                             <complexType>
    11                                     <simpleContent>
    12                                             <extension base="string">
    13                                                     <attribute name="lang"/>
    14                                             </extension>
    15                                     </simpleContent>
    16                             </complexType>
    17                     </element>
    18             </sequence>
    19             <attribute name="xpath" type="string" use="required" xdb:SQLName="XPATH"/>
    20             <attribute name="locator" type="string" use="required"/>
    21     </complexType>
    22     <simpleType name="languages">
    23             <list itemType="string"/>
    24     </simpleType>
    25     <element name="trados" xdb:defaultTable="ECG_REP_TRADOS_TAB" xdb:tableProps="VARRAY XMLDATA.ENTRY STORE AS TABLE ECG_REP_TRA
    DOS_ENTRY_TAB ((PRIMARY KEY (NESTED_TABLE_ID, SYS_NC_ARRAY_INDEX$)) ORGANIZATION INDEX OVERFLOW)">
    26             <complexType>
    27                     <sequence>
    28                             <element name="entry" type="tns:entry" minOccurs="0" maxOccurs="unbounded" xdb:SQLName="ENTRY"/>
    29                     </sequence>
    30                     <attribute name="cid" type="string"/>
    31                     <attribute name="path" type="string"/>
    32                     <attribute name="lang" type="string"/>
    33                     <attribute name="langs" type="tns:languages"/>
    34                     <attribute name="oldversion" type="string"/>
    35             </complexType>
    36     </element>
    37  </schema>');
    38  begin
    39    dbms_xmlschema.registerSchema
    40    (
    41        schemaurl => 'http://ecoit.hp.com/ecg/repository/trados.xsd'
    42       ,schemadoc => xmlschema
    43       ,local     => TRUE
    44       ,genBean   => false
    45       ,genTypes  => TRUE
    46       ,genTables => TRUE
    47       ,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
    48    );
    49  end;
    50  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.68
    SQL> declare
      2    xmlschema xmltype := XMLTYPE(
      3  '<?xml version="1.0" encoding="UTF-8"?>
      4  <!-- edited with XMLSpy v2008 (http://www.altova.com) by Jan-Erik Pedersen (HEWLETT PACKARD) -->
      5  <!--W3C Schema generated by XMLSpy v2007 (http://www.altova.com) by Scott Dismukes (Hewlett Packard)-->
      6  <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" xmlns:tns="http://ecoit.hp.com/ecg/rep
    ository/eco/category" xmlns:cns="http://ecoit.hp.com/ecg/repository/types" targetNamespace="http://ecoit.hp.com/ecg/repository/eco/c
    ategory" elementFormDefault="qualified">
      7     <import namespace="http://ecoit.hp.com/ecg/repository/types" schemaLocation="http://ecoit.hp.com/ecg/repository/types.xsd"/>
      8     <complexType name="productFamilies">
      9             <sequence>
    10                     <element name="productFamily" type="tns:productFamily" minOccurs="0" maxOccurs="unbounded"/>
    11                     <element name="product" type="tns:product" minOccurs="0" maxOccurs="unbounded"/>
    12             </sequence>
    13             <attribute name="lang" use="required" xdb:SQLName="LANG">
    14                     <simpleType>
    15                             <restriction base="string">
    16                                     <length value="5"/>
    17                             </restriction>
    18                     </simpleType>
    19             </attribute>
    20             <attribute name="version" use="required" xdb:SQLName="VERSION">
    21                     <simpleType>
    22                             <restriction base="string">
    23                                     <maxLength value="100"/>
    24                             </restriction>
    25                     </simpleType>
    26             </attribute>
    27     </complexType>
    28     <complexType name="productCategory">
    29             <sequence>
    30                     <element name="label" type="cns:label"/>
    31                     <element name="productCategory" type="tns:productCategory" minOccurs="0" maxOccurs="unbounded" xdb:defaultTa
    ble="ECG_REP_ECO_CATALOG_PC_TAB"/>
    32                     <element name="product" type="tns:product" minOccurs="0" maxOccurs="unbounded"/>
    33             </sequence>
    34             <attribute name="id" type="cns:id" use="required"/>
    35     </complexType>
    36     <complexType name="productCategories">
    37             <sequence>
    38                     <element name="productCategory" type="tns:productCategory" minOccurs="0" maxOccurs="unbounded"/>
    39             </sequence>
    40     </complexType>
    41     <complexType name="column">
    42             <sequence>
    43                     <element name="label" type="cns:label"/>
    44             </sequence>
    45             <attribute name="id" type="cns:id" use="required"/>
    46     </complexType>
    47     <complexType name="product">
    48             <sequence>
    49                     <element name="label" type="cns:label"/>
    50                     <element name="column" type="tns:column" minOccurs="0" maxOccurs="unbounded"/>
    51             </sequence>
    52             <attribute name="id" type="cns:id" use="required"/>
    53     </complexType>
    54     <complexType name="productFamily">
    55             <sequence>
    56                     <element name="label" type="cns:label"/>
    57                     <element name="image" type="cns:image" minOccurs="0" maxOccurs="unbounded"/>
    58                     <element name="link" type="cns:link" minOccurs="0" maxOccurs="unbounded"/>
    59                     <element name="column" type="tns:column" minOccurs="0" maxOccurs="unbounded"/>
    60                     <element name="productCategories" type="tns:productCategories" minOccurs="0" maxOccurs="unbounded"/>
    61             </sequence>
    62             <attribute name="id" type="cns:id" use="required"/>
    63     </complexType>
    64     <element name="productFamilies" type="tns:productFamilies" xdb:defaultTable="ECG_REP_ECO_CATALOG_TAB"/>
    65  </schema>
    66  ');
    67  begin
    68    dbms_xmlschema.registerSchema
    69    (
    70        schemaurl => 'http://ecoit.hp.com/ecg/repository/eco/category.xsd'
    71       ,schemadoc => xmlschema
    72       ,local     => TRUE
    73       ,genBean   => false
    74       ,genTypes  => TRUE
    75       ,genTables => TRUE
    76       ,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
    77    );
    78  end;
    79  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:01.65
    SQL> CREATE INDEX ECG_REP_ENTRY_XPATH_IDX ON ECG_REP_TRADOS_ENTRY_TAB ("XPATH", "NESTED_TABLE_ID")
      2  /
    Index created.
    Elapsed: 00:00:00.01
    SQL> set pages 0 lines 160
    SQL> set long 10000
    SQL> --
    SQL> set autotrace on explain
    SQL> --
    SQL> xquery
      2  xquery version "1.0";
      3
      4  declare namespace typ = "http://ecoit.hp.com/ecg/repository/types";
      5  declare namespace c = "http://ecoit.hp.com/ecg/repository/eco/category";
      6  declare namespace t = "http://ecoit.hp.com/ecg/repository/trados";
      7
      8  declare variable $c := $res/c:productFamilies;
      9
    10  declare function local:pc($pc as element(c:productCategory), $x as xs:string) as element() {
    11     <c:productCategory id="{$pc/@id}">
    12     {
    13             <c:label>{data($es/t:entry[@xpath eq concat($x, "/label")]/t:translation)}</c:label>
    14             ,
    15             for $p in $pc/c:product
    16             return local:p($p, concat($x, "/product/[@id=", $p/@id, "]"))
    17             ,
    18             for $pcc in $pc/c:productCategory
    19             return local:pc($pcc, concat($x, "/productCategory[@id=", $pcc/@id, "]"))
    20     }
    21     </c:productCategory>
    22  };
    23
    24  declare function local:p($p as element(c:product), $x as xs:string) as element() {
    25     <c:product id="{$p/@id}">
    26     {
    27             <c:label>{string($es/t:entry[@xpath eq concat($x, "/label")]/t:translation)}</c:label>
    28             ,
    29             for $col in $p/c:column
    30             return
    31             <c:column id="{$col/@id}">
    32                     <c:label>
    33                     {
    34                             let $e := $es/t:entry[@xpath eq concat($x, "/column[@id=", $col/@id, "]/label")]
    35                             return
    36                             if(exists($e)) then string($e/t:translation)
    37                             else $col/c:label/text()
    38                     }
    39                     </c:label>
    40             </c:column>
    41     }
    42     </c:product>
    43  };
    44
    45  <c:productFamiles xsi:schemaLocation="http://ecoit.hp.com/ecg/repository/eco/category http://ecoit.hp.com/ecg/repository/eco/ca
    tegory.xsd  http://ecoit.hp.com/ecg/repository/types  http://ecoit.hp.com/ecg/repository/types.xsd" lang="{$lang/lang/text()}" versi
    on="{$c/@version}"> {
    46     for $pf in $c/c:productFamily
    47     let $x := concat("/productFamily[@id=", $pf/@id, "]")
    48     return
    49     <c:productFamily id="{$pf/@id}">
    50     {
    51             (:xpath index can not be applied within function:)
    52             <c:label>{data($es/t:entry[@xpath eq concat($x, "/label")]/t:translation)}</c:label>
    53             ,
    54             for $img in $pf/c:image
    55             return $img
    56             ,
    57             for $link in $pf/c:link
    58             return $link
    59             ,
    60             for $col in $pf/c:column
    61             return
    62             <c:column id="{$col/@id}">
    63                     <c:label>{data($es/t:entry[@xpath eq concat($x, "/column[@id=", $col/@id, "]/label")]/t:translation)}</c:lab
    el>
    64             </c:column>
    65             ,
    66             for $pcs in $pf/c:productCategories
    67             return
    68             <c:productCategories>
    69             {
    70                     for $pc in $pcs/c:productCategory
    71                     return local:pc($pc, concat($x, "/productCategories/productCategory[@id=", $pc/@id, "]"))
    72             }
    73             </c:productCategories>
    74     }
    75     </c:productFamily>
    76     ,
    77     for $p in $c/c:product
    78     return local:p($p, concat("/product[@id=", $p/@id, "]")) } </c:productFamiles>
    79  /
    ERROR:
    ORA-19228: XPST0008 - undeclared identifier: prefix 'res' local-name ''
    Elapsed: 00:00:00.01
    SQL>

  • Please help for User defined extension functions

    the tutorial given for extension functions doesn't work as well as our new functions
    even though i follow all the given steps and see the functions in my user defined extension functions tab in xslt map.
    all the target nodes that use the extension function disappear in the resulted target xml.
    please help.

    have you compiled your java file and uploaded the jar file(containg the .class file and the Manifest.MF file) in the <OC4J_HOME>\j2ee\home\applib directory and then restarted the server??

  • Component Palette --- "User Defined Extension Functions" not visible

    I added a User-Defined XPath Extension Function in JDeveloper 11.1.1.3.0 --> Tools > Preferences > SOA As given here http://download.oracle.com/docs/cd/E15523_01/integration.1111/e10224/bp_appx_functs.htm#BEIHEBIJ
    But I am not able see "User Defined Extension Functions" section itself in the component palette. Do I need to enable anything for see the section.
    Can somebody help.
    Thanks

    Hi,
    I am trying to create user defined extension function in JDeveloper 10.1.3.4 to be used with the Oracle ESB.I have followed the documentation provided by the Oracle to resolve this issue without any success can you please help me in providing me the details how did you resolved this issue.
    Anticipating your earliest reply
    regards
    Narasimha

  • User Defined External Function - How to work?

    I have defined some external functions in java by following the description in
    C:\OraBPELPM_3\integration\orabpel\samples\demos\XSLMapper\ExtensionFunctions
    I can use my functions in JDeveloper, but they do not work on the Oracle BPEL engine.
    Is it enough just to place the jar-file in <OC4J_HOME>\j2ee\home\applib and add the jar-file in class-path (as described)?
    What about the xml-file specifying the functions (called SampleExtentionFunctions.xml in the documentation)?
    Should this file be copied to <OC4J_HOME>\... ?
    Here is the error message I get by running my service:
    XPath expression failed to execute.
    Error while processing xpath expression, the expression is "ora:processXSLT("TransformationInput.xsl", bpws:getVariableData("inputVariable", "request"))", the reason is java.lang.NoSuchMethodException: For extension function, could not find method org.apache.xpath.objects.XNodeSet.leadingZeros([ExpressionContext,] #NUMBER)..
    Please verify the xpath query.
    ______________ MY JAVA CODE EXAMPLE: _____________________________
    package extentionfunctions;
    This is a sample XSL Mapper User Defined Extension Functions implementation class.
    public class JavaExtensionFunctionsBpel
    * Inserts leading zeros to a text, if this starts with a digit.
    * Else the return value will be the same as the given text.
    * The return value will have the specified length.
    public static String leadingZeros(String text, int len)
    {  String retur = text;
    char c = (text == ""?'0':text.charAt(0));
    if ('0'<=c && c<='0'+9) { // Is first char a digit?
    retur = "";
    int n = len - (text == ""?0:text.length());
    for (int i=0; i<n; i++) { // Insert zeros:
    retur = '0' + retur;
    retur = retur + text;
    return retur;
    * Removes leading zeros from a text.
    public static String removeLeadingZeros(String text)
    {  String retur = text;
    int pos = 0;
    int len = (text == ""?0:text.length());
    for (int i=0; i<len; i++) {
    if (text.charAt(i)=='0') { // Is char a digit?
    pos++;
    return retur;
    public static void main(String[] args)
    { // Basic test of functions:
    int len = 5;
    String s = "1234";
    String r;
    System.out.println("leadingZeros("+s+","+len+")="+(r=leadingZeros(s,len)));
    System.out.println("removeLeadingZeros("+r+")="+removeLeadingZeros(s));
    Regards
    Flemming Als

    Flemming, it looks like somthing is wrong in the xsl that it still goes to org.apache.xpath.objects.XNodeSet package instead of yours ..
    I created a sample that illustrates the usage of this functions (even with 2 params, different types).
    Java class (com.otn.samples.xslt.CustomXSLTFunctions)
    package com.otn.samples.xslt;
    public class CustomXSLTFunctions
    <function name="extension:multiplyStringAndInt" as="number">
    <param name="base" as="String"/>
    <param name="multiplier" as="number"/>
    </function>
    public int multiplyStringAndInt (String pString, int pMultiplier)
    int base = Integer.parseInt(pString);
    return base * pMultiplier;
    XML descriptor:
    Note the types (in the java class and the xml descriptor)
    for java:base -> string and for xslt:base -> string
    for java:multiplier -> int and for xslt:multiplier -> number
    <?xml version="1.0" encoding="UTF-8"?>
    <extension-functions>
    <functions extension:multiplyStringAndInt="http://www.oracle.com/XSL/Transform/java/com.otn.samples.xslt.CustomXSLTFunctions">
    <function name="extension:multiplyStringAndInt" as="number">
    <param name="base" as="string"/>
    <param name="multiplier" as="number"/>
    </function>
    </functions>
    </extension-functions>
    Definition of variables in the process:
    (as you can see, the base is a string - I do the conversion in my method, and the return value
    is converted to a string by the engine)
    <!-- Input -->
    <element name="CustomXSLTFunctionProcessRequest">
    <complexType>
    <sequence>
    <element name="base" type="string"/>
    <element name="multiplier" type="int"/>
    </sequence>
    </complexType>
    </element>
    <!-- Output -->
    <element name="CustomXSLTFunctionProcessResponse">
    <complexType>
    <sequence>
    <element name="result" type="string"/>
    </sequence>
    </complexType>
    </element>
    Using the new function in the XSL transformation:
    - watch out for the namespace declaration (xmlns:sample="...")
    - and the usage (sample:multiplyStringAndInt)
    <xsl:stylesheet version="1.0"
    xmlns:ldap="http://schemas.oracle.com/xpath/extension/ldap"
    xmlns:xp20="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.Xpath20"
    xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
    xmlns:plnk="http://schemas.xmlsoap.org/ws/2003/05/partner-link/"
    xmlns:extension="http://www.oracle.com/XSL/Transform/java/com.otn.samples.xslt.CustomXSLTFunctions"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:ora="http://schemas.oracle.com/xpath/extension"
    xmlns:ns0="http://www.w3.org/2001/XMLSchema"
    xmlns:orcl="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.ExtFunc"
    xmlns:client="http://xmlns.oracle.com/CustomXSLTFunction"
    exclude-result-prefixes="xsl plnk ns0 client ldap xp20 bpws extension ora orcl">
    <xsl:template match="/">
    <client:CustomXSLTFunctionProcessResponse>
    <client:result>
    <xsl:value-of select="extension:multiplyStringAndInt(/client:CustomXSLTFunctionProcessRequest/client:base,/client:CustomXSLTFunctionProcessRequest/client:multiplier)"/>
    </client:result>
    </client:CustomXSLTFunctionProcessResponse>
    </xsl:template>
    </xsl:stylesheet>
    Then I created a jar file with the class (and for testing the xml descriptor in it)...
    and put it into j2ee/home/applib directory
    hth clemens

  • User Defined Extension functions XML file

    Hi,
    Can we define exception In custom XSLT function XML file.
    Like i have following Custom XSLT function XML-
    <?xml version="1.0" encoding="UTF-8"?>
    <extension-functions>
    <functions xmlns:uppercase="http://www.oracle.com/XSL/Transform/java/oracle.Uppercase">
    <function name="uppercase:GetName" as="string">
    <param name="fname" as="string"/>
    <param name="lname" as="string"/>
    </function>
    </functions>
    </extension-functions>
    So in case i need to throw an exception in my java function GetName so how can i define that in XML?
    Please give some suggestion?
    Thanks.

    Hi,
    Thanks for your reply. When I created extensions.xml (as advised by you) and tried specifying it as User Defined Extension Functions Config file, I get the following error:
    Invalid User Extension Functions Config File
    Invalid value 'object' for attribute:'as' line 5 column 52
    i.e. the following line:
    <function name="extensions:getMSPDate" as="object">
    Any pointers on what will be the correct value for attribute 'as' for element 'function'?
    Also, what is the default namespace being used in the extensions.xml?
    Is there a link for more documentation on the format for extensions.xml?

Maybe you are looking for

  • Is there a way to escalate a complaint to someone ...

    I live in the Bolton area with my family but I travel a lot and am currently in the USA, trying to solve this issue long distance. One of my adult children was moving house and I was transferring the BT package I have - phone, BT Vision, broadband, i

  • Disabled iPod not recognized by iTunes, completely locked.

    Hello, Recently, a friend of mine who had my iPod touch at the time was playing around with it, just basically messing with random settings. He set a passcode made up of random numbers in the process, neither of us know the combination. We made a few

  • How do you add a menus to a menu bar???

    /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the FormEditor. I can't edit the code (eg. private void initComponents() { menuB

  • Problems with deploying ODAC to web server

    I have a ASP.NET 4.0 MVC application using Entity Framework and ODAC r4 11.2.0.3.0. I have Oracle 10g client installed on the server (2003) already. I installed the 32-bit ODAC 4 XCopy deployment to the server using the batch file. So I have two Orac

  • What are the standard def channels you receive with the SD receiver?

    Nowhere on the site can I find a clear definitiion of what you receive with the $5.99 SD receiver as opposed to what you get without it. I can see that you get up to CH 49 with a std cable TV tuner but I don't see what else you get with the $5.99 set