XPath eval function

I am looking for a function in xPath that is equivalent to eval() in javascript.
Basically I have to fields in  a database used for conversion
Operator --values can be   *   +    -      /
Amount  --numeric value
I want to apply the operator and amount to a value inside a transaction. 
Example. 
Local.Operator =  " * "
Local.Amount = 10
I am looping through tag values and want to dynamically apply the operator and amoun
Local.NewAmount = LoopValue Local.Operator  Local.Amount
I want it to   evaluate it to    Local.NewAmount =   LoopValue * 10 
in javascript it is eval(LoopValue Local.Operator  Local.Amount).
Any ideas how to do this in a transaction?
Thanks

Thanks for the idea, I will give it a try.  
I also created a small transaction that just uses a switch statement based on the operator, and then adds, multiplies etc. Then returns the value.   It works well for reuse, since multiple transactions need this funcitonality.
Just have to see which method works better.
Thanks again,
Jeff

Similar Messages

  • Jar-file for XPath extension functions

    Hi all,
    can anyone tell me which jar-file contains the class for the following xpath extension function / method:
    oracle.tip.pc.services.functions.Xpath20.currentDate
    I need this for an ant xsl validation which runs without JDev.
    Thanks in advance, Ingo

    When you go to :
    <ORACLE_HOME>/bpel/system/config
    you will find the file : xpath-functions.xml
    In this file you will see :
        <function id="getCurrentDate" arity="0">
            <classname>com.collaxa.cube.xml.xpath.functions.datetime.GetCurrentDateFunction</classname>
            <comment>
            <![CDATA[This function returns current date as string.
            <p/>
            The signature of this function is <i>ora:getCurrentDate('format'?)</i>.  The argument (optional) specifies a string formatted accoding to java.text.SimpleDateFormat format.]]>
            </comment>
            <property id="namespace-uri">
                <value>http://schemas.oracle.com/xpath/extension</value>
                <comment>Namespace URI for this function</comment>
            </property>
            <property id="namespace-prefix">
                <value>ora</value>
                <comment>Namespace prefix for this function</comment>
            </property>
        </function>This classname can be found in the orabpel.jar
    sorry..wrong function..
    Message was edited by:
    Eric Elzinga (IT-Eye)

  • Equivalent to EVAL function in PHP?

    Based on what option the user selects from my select list, my APEX report of type SQL query should be rendered.
    This works fine for situations like:
    SELECT * FROM table_name WHERE field_name = :P101_item_name
    But here I face the problem:
    In case the user selects option one, I want to fetch all rows, where field_name = NULL, if she selects the second option all rows with field_name <> NULL should be fetched. If she selects the third option, all options should be retrieved.
    I e.g. tried to create the static List of Values and assigned to the options the values "NULL", "NOT NULL"..
    yet
    SELECT * FROM table_name WHERE field_name is :P101_item_name
    does not work..
    How can I solve this? Is there any function similar to the eval function of php? Thanks a lot.

    In PL/SQL land the equivalent is EXECUTE IMMEDIATE - essentially allowing you to execute dynamic SQL.
    In APEX, you have various other options available to you. For instance, we can create PL/SQL anonymous blocks that return SQL or indeed functions that take arguments and return a SQL string. APEX will then handle the process of taking this string, EXECUTE IMMEDIATE'ing it, and returning your desired report.
    See here for a good discussion.
    Re: Passing a Table Name as a variable to a Page Process
    Also search for 'dynamic SQL', 'dynamic table names', 'dynamic LOVs' on the forum as this comes up regularly related to LOV filters.

  • XPath max function

    Hi all,
    I'm a beginner working with XPath expressions.
    I have a xml document 'test.xml' with the following contents.
    <?xml version="1.0" encoding="UTF-8"?>
    <ICRI xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.orswegimoarmada.es/ORSWE/ICRI
    http://www.orswegimoarmada.es/ORSWE/XSD/ICRI/ICRI.xsd"
    xmlns="http://www.orswegimoarmada.es/ORSWE/ICRI">
    <ID>ICRI.Prueba.DocPrueba1.2006.11.15-09.19.01</ID>
    <NombreRecurso>DocPrueba1</NombreRecurso>
    <TipoRecurso>Documento Técnico</TipoRecurso>
    <Descripcion>Documento de ejemplo.</Descripcion>
    <ExtensionRecurso/>
    <VersionRecurso>1.0</VersionRecurso>
    <Estado>En Proceso</Estado>
    <NivelSeguridad>NATO UNCLASSIFIED</NivelSeguridad>
    <Entornos/>
    <PalabrasClave/>
    <Sinonimos/>
    <Modificaciones>
    <Modificacion>
    <Usuario>demoadminpro</Usuario>
    <FechaHora>2006.11.15-09.19.01</FechaHora>
    <Secuencia>1</Secuencia>
    <EnlaceRecurso>/ORSWE/Proyectos/Prueba/Documento Técnico/DocPrueba1.2006.11.15-09.19.01.xml</EnlaceRecurso>
    </Modificacion>
    <Modificacion>
    <Usuario>demoadminpro</Usuario>
    <FechaHora>2006.11.15-09.20.01</FechaHora>
    <Secuencia>2</Secuencia>
    <EnlaceRecurso>/ORSWE/Proyectos/Prueba/Documento Técnico/DocPrueba1.2006.11.15-09.20.01.xml</EnlaceRecurso>
    </Modificacion>
    <Modificacion>
    <Usuario>demoadminpro</Usuario>
    <FechaHora>2006.11.15-09.21.01</FechaHora>
    <Secuencia>3</Secuencia>
    <EnlaceRecurso>/ORSWE/Proyectos/Prueba/Documento Técnico/DocPrueba1.2006.11.15-09.21.01.xml</EnlaceRecurso>
    </Modificacion>
    </Modificaciones>
    </ICRI>
    I use the code to obtain information about xml.
    SELECT extractValue(value(d), '/ICRI/NombreRecurso', 'xmlns="http://www.orswegimoarmada.es/ORSWE/ICRI"') NOMBRERECURSO,
           extractValue(value(d), '/ICRI/TipoRecurso', 'xmlns="http://www.orswegimoarmada.es/ORSWE/ICRI"') TIPORECURSO,
            extractValue(value(d), '/ICRI/VersionRecurso', 'xmlns="http://www.orswegimoarmada.es/ORSWE/ICRI"') VERSIONRECURSO,
            extractValue(value(d), '/ICRI/Descripcion', 'xmlns="http://www.orswegimoarmada.es/ORSWE/ICRI"') DESCRIPCION,
            extractValue(value(d), '/ICRI/Modificaciones/Modificacion/Secuencia', 'xmlns="http://www.orswegimoarmada.es/ORSWE/ICRI"') SECUENCIA
    FROM RESOURCE_VIEW r, table(xmlsequence(extract(r.res, '/r:Resource/r:Contents/i:ICRI', 'xmlns:r="http://xmlns.oracle.com/xdb/XDBResource.xsd" xmlns:i="http://www.orswegimoarmada.es/ORSWE/ICRI"'))) d
    WHERE r.any_path='test.xml'But the element Secuencia has several values and I only need to obtain the max of this values. I think, XPath max function can resolve this issue, but I don't know how do I do this?. Is it possible?
    Thanks in advance,
    David.

    Well, I am desperate :-(((
    I am trying to extend the early query, now, r.any_path must be obtained from another table that it is another registered schema also.
    The folowing is a piece of this query:
    SELECT
    extractValue(value(di), '/ICRI/NombreRecurso', 'xmlns="http://www.orswegimoarmada.es/ORSWE/ICRI"') NOMBRERECURSO,
    extractValue(value(di), '/ICRI/TipoRecurso', 'xmlns="http://www.orswegimoarmada.es/ORSWE/ICRI"') TIPORECURSO,
    extractValue(value(di), '/ICRI/VersionRecurso', 'xmlns="http://www.orswegimoarmada.es/ORSWE/ICRI"') VERSIONRECURSO,
    extractValue(value(di), '/ICRI/Descripcion', 'xmlns="http://www.orswegimoarmada.es/ORSWE/ICRI"') DESCRIPCION
    FROM RESOURCE_VIEW r,
         table(xmlsequence(extract(r.res, '/r:Resource/r:Contents/i:ICRI', 'xmlns:r="http://xmlns.oracle.com/xdb/XDBResource.xsd" xmlns:i="http://www.orswegimoarmada.es/ORSWE/ICRI"'))) di
    WHERE
        r.any_path IN 
        (select extractValue(value(t), '/InfoEntradaGeneral/EnlaceICRI', 'xmlns="http://www.orswegimoarmada.es/ORSWE/PlantillaProyecto')
         FROM PLANTILLAPROYECTO p, table(xmlsequence(extract(p.object_value, '/PlantillaProyecto/Proceso/Pasos/Paso[@IdPaso="0"]/Actividades/Actividad[@IdActividad="1"]/EntradasActividad/EntradasGenerales/InfoEntradaGeneral'))) t
         WHERE existsNode(p.object_value, '/PlantillaProyecto/DetallesProyecto[NombreProyecto="Prueba"]')=1);Now, Oracle only shows me a register when the query must be three.
    The query
    select extractValue(value(t), '/InfoEntradaGeneral/EnlaceICRI', 'xmlns="http://www.orswegimoarmada.es/ORSWE/PlantillaProyecto')
    FROM PLANTILLAPROYECTO p, table(xmlsequence(extract(p.object_value, '/PlantillaProyecto/Proceso/Pasos/Paso[@IdPaso="0"]/Actividades/Actividad[@IdActividad="1"]/EntradasActividad/EntradasGenerales/InfoEntradaGeneral'))) t
    WHERE existsNode(p.object_value, '/PlantillaProyecto/DetallesProyecto[NombreProyecto="Prueba"]')=1);returns several values, for instance:
    1. test.xml
    2. test1.xml
    3. test2.xml
    Why does not it work?. I suppose that the query is correct.
    I try the same with relational tables and it works fine.
    Query SELECT B.COLUMN2 FROM B WHERE B.COLUMN1 IN (SELECT COLUMN1 FROM A returns several values from A and shows the right values from B.
    Please, Could someone to help me?
    Thanks in advance,
    David.

  • How can HANA Server Side JavaScript use "Eval" function?

    Hi HANA Experts,
      I use EVAL function to create an object by classname in xsjs file, but it has an Error "Eval is evil". In Client javascript, we can use the Eval function. How can we use "EVAL" function in HANA server side javaScript?  Thanks a lot.

    That looks like the client side JSLint check to me.  Those can be customized or even turned off. If you truly want to use eval.
    >XSJS inherits most of the features of javascript but do not expect all of its features
    Actually that's not exactly accurate.  XSJS is standard ECMA JavaScript (Mozilla SpiderMonkey VM).  It does run in strict mode, however. This isn't a limitation of XSJS but a conscious decision to force the VM into the strict mode - which is really the recommendation for JavaScript anyway.  We also apply JSLint checks as above. Sometimes they are quite restrictive. However they can be customized or even completely turned off at the project level:
    To the point of Eval, there are some excellent articles online.
    http://javascriptweblog.wordpress.com/2010/04/19/how-evil-is-eval/
    coding style - When is JavaScript&amp;#39;s eval() not evil? - Stack Overflow
    JSLint Error Explanations - eval is evil

  • Using the XPATH expression function in Transformation activity

    Hi,
    I have to map the variable value(other than the source variable) to one of the node in the target variable in the transformation activity. For that I am using the XPATH expression function bpws:getVariableData ('variableName') and map it to corrsponding target node. But this mapping is not at all happening. The same prolem occurs while using function ora:getInstanceID() in transformation function. Then I could find a metalink note id: 387381.1,saying it as the bug in 10.1.2.2 BPEL PM, which they are covering in the next release. But our BPEL PM version is 10.1.3.3. But still the same type of problem occurs.
    Please let me know, is there are any solution for using the ora:getInstanceID() , bpws:getVariableData in Transformation activity.

    Hi,
    I dont understand why would you need to use the "bpws:getVariableData" function.
    When you are mapping a source-node to a target-node, it usually assigns the value in the source-node to the target-node, which is as good as using the "bpws:getVariableData" function.
    So, technically speaking you need to use this function explicitly to achieve that ...
    Also, if you want the instance-id, you can use the "ora:getInstanceId()" directly in the BPEL code than using it in the transformation.
    Regards,
    Madhu.

  • In built eval function for Logical expression?

    I want to create a eval function to evaluate logical string expression like a==b?true:false which comes as a String. Is there anything provided by Flex

    If you have EXP utility installed on your machine, a button trigger you can do:
    HOST('EXP SCOTT/TIGER FILE=C:\Backup.dmp TABLES=(EMP, DEPT)');This will work both in client/server and web deployed, but in web deployed forms it will run on the application server and not the client machine.
    To run it on the client machine you must use CLIENT_HOST.
    Tony

  • Eval functionality for AS3?

    I have searched through the forums and the web on this topic
    but can't seem to find a solution that works for my situation. I
    used to use the eval function in AS2 to access methods and
    properties of dynamically named variables but it seems to be much
    different in AS3.
    A simple example :
    var number_of_records:int=10;
    var i:int = 1;
    do {
    // the next line is what i want to emulate in AS3
    eval(mydynamicvariable_+i)._alpha = 0
    i+=1;
    }while (i<=number_of_records);
    Below is a different example and actually pertains more to to
    my question than the above example.
    I am get variables from a text file. Got that part working.
    My variables are going to be put into an array and then used in a
    dataprovider for the datagrid component. Got the last part working
    too. Just having difficulty accessing my variables dynamically and
    then putting them in an array. First I just want to trace my
    variables and that is what i am having difficulty doing. I can
    trace them with hardcoding them but not dynamically.
    //////////////My data.txt file example is:
    number_of_records= 10
    &record_1=variable 1
    &first_name_1=this someones name 1
    &last_name_1=this is somones last name 1
    &details_1=just some text 1
    &record_2=variable 2
    &first_name_2=this someones name 2
    &last_name_2=this is somones last name 2
    &details_2=just some text 2
    //////////////.. and so on to 10 for this example..
    //////////////My data.txt file is loaded with the following
    code into flash CS3 using AS3
    var myURLLoader:URLLoader= new URLLoader();
    var myURLRequest:URLRequest = new URLRequest("data.txt");
    myURLLoader.dataFormat=URLLoaderDataFormat.VARIABLES;
    myURLLoader.load(myURLRequest);
    myURLLoader.addEventListener(Event.COMPLETE, dataOK);
    function dataOK(myevent1:Event):void{
    var
    number_of_records:int=myURLLoader.data.number_of_records;
    trace("data is loaded");
    trace("number_of_records="+number_of_records);
    var i:int = 1;
    do {
    //////////////THE CODE ON THE NEXT FEW LINES IS MY QUESTION
    //////////////THE SECOND HALF IS HOW I WOULD WRITE IT IN AS2
    TO DYNAMICALLY ACCESS THE VARIABLES
    trace(
    "record_"+i.toString()+"="+eval("myURLLoader.data.record_"+i));
    trace(
    "first_name_"+i.toString()+"="+eval("myURLLoader.data.first_name_"+i));
    trace(
    "last_name_"+i.toString()+"="+eval("myURLLoader.data.last_name_"+i));
    trace(
    "details_"+i.toString()+"="+eval("myURLLoader.data.details_"+i));
    i+=1;
    }while (i<=number_of_records);
    How do i trace those variables with a loop using AS3? I can
    then figure out how to put it into the array and to get the info
    into the datagrid. Hope that I have provided enough information
    about my problem and hope that it is a simple solution.
    Please help and thanks!

    Andrei1 your awesome. Thanks dude! That's exactly what I was
    looking for. I actually did something similar but my syntax was not
    correct. I tried :
    trace(
    "record_"+i.toString()+"="+myURLLoader.data.["record_"+i])
    ///with a period before the []
    obviously wrong. Thanks again.
    trace(
    "record_"+i.toString()+"="+myURLLoader.data["record_"+i])
    ///without the period was correct.

  • Eval function

    Hi,
    Does anybody know if J2ME-MIDP has something similar to the eval function in JavaScript? I have a function that does a method call of an object, but I don't know in advance which object I get or which method I have to call.
    The function would look something like this:
    public void myMethodCall(Object object, String method)
    eval(object + "." + method);
    // call: myMethodCall(myObject, "doSomething()");
    // the function would do the following:
    // myObject.doSomething()

    no reflection capabilities are supported, so serialization, dynamic method invokation etc. are not supported too

  • Eval function and loading files

     I HAVE BEEN TAKING THAT APPROACH AND IT DOES HELP NOW I AM STUCK WITH USING THE EVAL FUNCTION AS I HAD WORKING FINE IN MATLAB. AS AN EXAMPLE, I INPUT THE FILE NAME, THEN USE EVAL TO LOAD THE FILE. EXAMPLE, 
    DATAFILE=INPUT(' TYPE NAME OF DATA FILE IN SINGLE QUOTES    ')
    EVAL (['LOAD',DATAFILE]);  
    NOW IN MATHSCRIPT I HAVE NOT FOUND A SYNTAX THAT WORKS.
    PLEASE ADVISE,
    CHUCK 

    cek wrote:
    So far no comments on this issue.  Please advise, is there a solution?
    Chuck 
    For starters, you should NOT mark your question as accepted solution, else we think the problem has been solved. If you don't get replies, it could also be that the question is too confusing. So please go back to the other thread and maybe add more details or clarification.
    Also, posts in all upper case are a bit hard to read so some might simply ignore such posts.
    LabVIEW Champion . Do more with less code and in less time .

  • Xpath Expression/Functions in XSLT Mapper

    Manual says I can use the orcl functions as well as Xpath Expressions, but when I try to execute it does not work? am I missing something her?
    Trying to get a variable data into the target schema , the var is not in the source data schema?
    Any suggestions?

    Can you explain a bit more what you want to do. It's very vague right now. Probably will be able to help you out.
    Thanks

  • XPath+XSLT: Re-adding parts of the document after XPath eval. (fragment)

    Hello all,
    Sorry, I know that this is not strictly a Java related problem, but who knows if there are standard API functions for that...
    Imagine this simple XML document:
    <document>
       <meta>
         [some deeper structs]
       </meta>
       <content>
          <chapter id="1">
          </chapter>
          <chapter id="2">
          </chapter>
          <chapter id="3">
          </chapter>
       </content>
    </document>Normally, I transform the entire document via XSLT e.g. to XHTML. But if I want just to extract e.g. the first chapter using XPath evaluation, I do not have other "static" parts of the document, e.g. the meta part or the document root.
    Currently, I am adding this very complicated by having the XPath evaluation as a string and by prepending and appending the "static" part in order to have a fully working XSL transformation (e.g. "<document><meta>[...]</meta><content>" + xpathEval + "</content></document>")...
    Are there any best practises? I think using XPath is very nice for this kind but maybe the wrong way and I should filter another way? Hope there is an elegant way whith sticking to XPath though...
    Thanks and regards,
    Timo

    Rehi DrClap,
    Thanks for your reply.
    Yes, that is pretty fine, but the problem is that I have some "static" parts like the "meta" tree are outside the "chapter n" tree.
    And just selecting for my chapter will result in just that tree but not the entire document pattern including the document root and the meta part.
    XSLT being more SAX'ish, I think I have to rebuild my document using DOM in a way that I do some consecutive XPath selections like for meta and chapter, create the root node, append them and then XSL transform that new document. However, that are much steps and not good for larger documents.
    Thx and regards,
    Timo

  • SOA XPath Extension Functions

    Hi any one can help my scenario I am new to BPM/SOA,
    I want to use this Xpath function for getting the previous task approver.{ hwf:getPreviousTaskApprover(bpmn:getDataObject('taskID'))}
    Let me know what exactly taskID is ?
    Can you please provide exact syntax and with any examples.
    Thanks & regards,
    Raju.

    Hi Raju,
    You need to get the taskId from the output of a human task in your previous Interactive activity in the process. Double click the Interactive -> click the activity's "Data Associations" in the "Implementation" tab -> click the "Output" tab -> expand the "execData" node and then expand the "systemAttributes" and scroll down to get to the "taskId" attribute you're looking for. There's more work you'll need to do to get this to work if you're going to use the getPreviousTaskApprover() method but at least this tells you how to get the prevous approver. This blog by Niall Commiskey goes into the detail on the remaining steps you have left to do after this: http://niallcblogs.blogspot.com/2011/06/pinning-tasks-to-user-in-bpm-11g.html.
    You might instead want to consider using the getLastPerformer() method. This method can be used inside the human task's assignment tab. To see what I'm talking about, determine the human task that is associated with the Interactive activity you want to assign to the previous participant -> in the BPM Project Navigator tab, expand the business catalog -> expand the "Human Tasks" -> double click the human task that is associated with the Interactive activity -> click the "Assignment" tab -> double click the person icon in the middle of the page next to the text "default...." -> in the dropdown beside the text "Build a list of participants using" scroll up and select "Names and expressions" from the dropdown -> click the plus icon -> click "Add User" -> change the Data Type from "By Name" to "By Expression" -> click the "..." button on the right -> click the dropdown below "Functions" -> click "BPM Functions" -> click "getLastPerformer" -> click "Insert Into Expression" -> click "OK".
    Dan

  • Error while executing BPEL xpath extension function : doXSLTransformForDoc

    Hi All,
    I have used the transform activity in BPEL that uses 2 input variable and one target variable and process gets complied successfully. However, when the is deployed on the SOA server and tested then I get the following error :
    =======================================================================
    <faultType>0</faultType><subLanguageExecutionFault xmlns="http://schemas.oracle.com/bpel/extension"><part name="summary"><summary>XPath expression failed to execute.
    An error occurs while processing the XPath expression; the expression is ora:doXSLTransformForDoc('file:/C:/JDeveloper/mywork/xsl/tranform_02.xsl',bpws:getVariableData('ListOfInterestVariable'),'receiveInput_Consume_Message_InputVariable.body',bpws:getVariableData('receiveInput_Consume_Message_InputVariable','body')).
    The XPath expression failed to execute; the reason was: internal xpath error.
    Check the detailed root cause described in the exception message text and verify that the XPath query is correct.
    </summary>
    </part><part name="code"><code>XPathExecutionError</code>
    </part></subLanguageExecutionFault>
    ========================================================================
    Please suggest
    Thanks.

    That is because the bpel file contains the absolute path to the xsl file instead of the relative path.
    ora:doXSLTransformForDoc('file:/C:/JDeveloper/mywork/xsl/tranform_02.xsl' .....
    should be
    ora:doXSLTransformForDoc('xsl/tranform_02.xsl' .....
    As far as I know, this is a bug in JDeveloper for putting this information here. I've removed it using the source view only to find it there again.

  • Eval function problem in new version

    Hello,
    I was using obiee 11.1.1.5 now migrated to 11.1.1.6.
    Now there is a report where i use Evalaute function but in new version its giving me following error while running the report
    [nQSError: 43113] Message returned from OBIS. EVALUATE_SUPPORT_LEVEL inside NQSConfig.INI is not set to support EVALUATE. (HY000)
    Previous version i don't rem setting anything in Config file.
    Thanks

    Changes to the NQSConfig.ini
    under the [SERVER] section
    add (if exists, please change) following line
    EVALUATE_SUPPORT_LEVEL = 2;
    Save and re-start BI Server.

Maybe you are looking for

  • How can I active the BADI  Z_ME_PROCESS_PO_CUST in SAP ECC 6.0?

    Dear all,        I have created new BADI Z_ME_PROCESS_PO_CUST in spro :Materials management=>Purchasing=>Business And-ins for Purchasing=>Badi:Enhance processing of Enjoy purchase order But I can not active this BADI in se19. SAP give me an informati

  • PO condition type for Refundable Container Deposit.

    Dear all, Container deposit is a refundable amount we pay to the shipping line, along with the other relevant charges for imports of full container shipments coming by sea. In the present set-up the container deposit amount is getting added to the "m

  • CS4 trial will not start/open

    I downloaded the full trial of DW CS4, clicked to open the program, I get the green DW box and it will not go any further, I disabled all firewalls and Virgin media security but it still won't start/open. All I get is the windows busy symbol, and the

  • Adding tables outside of your schema to Database diagram

    Say, from what I can tell, there is no way to import a table from outside of your own schema user to a database diagram. I can drag tables from my own connection, but if it is a table that I have a public synonym to, no dice? Anyone know if this is p

  • Depdeactivated

    Hi, I have 2 dep areas one is Book Dep and Other one is Tax Dep but user creating he not activated book dep now already asset aquistion posting made how can  i change is it possible or not? Thnaks and Regards Chennu