XMLTYPE Datatype - extracted value of an element based on the value in another element

Hi all

I have a typical XML problem in which I am trying to extract the value of a property on the base of another.

Here is an example of XML data:-

< object type = "InstanceObject:instanceKeyValue" version = "2" >

< property name = 'name' value = 'COUNTRY' valueType = "string" / >

< property name = "keyValueType" value = "VARCHAR" valueType = "string" / >

< property name = "keyValue" value = "SINGAPORE" valueType = "string" / >

< / object >

< object type = "InstanceObject:instanceKeyValue" version = "2" >

< property name = "name" value = "DATA_SET" valueType = "string" / >

< property name = "keyValueType" value = "VARCHAR" valueType = "string" / >

< property name = value 'keyValue' = 'April 9, 2014' valueType = "string" / >

< / object >

My requirement is-

If value = 'COUNTRY' under/object/property then I need the property value where @name = "keyValue" that is Singapore.

But when I do

SELECT EXTRACT('object/property[@name="instanceKeyValues"]/object/property[@name="keyValue"]/@value')

I get the two keyValues SINGAPORE09-APR-2014

While I only need Singapore.

No idea how we can solve this?

Sorry, I'm a jerk, so finally I just with this

with t as)
Select xmltype)
'
        
           
           
           
       

       
           
           
           
       


           
           
           
       

'
) x
of the double
)

Select
Val
t
xmltable)
"for $o in/root/object.
["Let $p: = $o/property[@name="keyValue "]
["where $o/property[@name="name"][@value="COUNTRY "]
Return $p'- or return $p/@value'
go x
columns
path of varchar2 (40) Val '@value' - or '.'
)

VAL
Singapore
India

Tags: Database

Similar Questions

  • Retrieve the item based on the content of another element

    I have an xml that looks like this

    <? XML version = "1.0" encoding = "UTF-8"? > < WF_EVENT_T xmlns = "http://xmlns.oracle.com/xdb/APPS/GetPOApprovalEvent" >
    < PRIORITY xmlns = "" > 50 < / PRIORITY >
    < SEND_DATE xmlns = "" > 2012-04-27T 15: 33:31.000 + 1200 < / SEND_DATE >
    < RECEIVE_DATE xmlns = "" > 2012-04-27T 15: 34:18.000 + 1200 < / RECEIVE_DATE >
    < CORRELATION_ID NULL = "TRUE" xmlns = "" / >
    < PARAMETER_LIST xmlns = "" >
    < PARAMETER_LIST_ITEM >
    APPLICATION_ID < NAME > < / NAME >
    < VALUE > 201 < / VALUE >
    < / PARAMETER_LIST_ITEM >
    < PARAMETER_LIST_ITEM >
    < NAME > DOCUMENT_DIRECTION < / NAME >
    < VALUE > ON < / VALUE >
    < / PARAMETER_LIST_ITEM >
    < PARAMETER_LIST_ITEM >
    < NAME > DOCUMENT_NO < / NAME >
    < VALUE > 363475 < / VALUE >
    < / PARAMETER_LIST_ITEM >
    < PARAMETER_LIST_ITEM >
    < NAME > ECX_DEBUG_LEVEL < / NAME >
    < VALUE > 0 < / VALUE >
    < / PARAMETER_LIST_ITEM >

    It is an object of purchase wf_event_t from e-Business Suite order. (The list is much longer)

    One of the parameter values is a number of PO

    < PARAMETER_LIST_ITEM >
    < NAME > PO_NUMBER < / NAME >
    < VALUE > 363475 < / VALUE >
    < / PARAMETER_LIST_ITEM >

    What I want to do is to look for the < VALUE > element based on the < NAME > element.

    that is, if NAME = PO_NUMBER THEN
    RETURNS the ELEMENT VALUE

    I suppose I could use a building WHILE in my BPEL but would like to know if there is anyway, this could be done with XPATH?

    See you soon

    Owen

    Hi Owen,.

    The xpath expression will be like:

    / WF_EVENT_T / [NAME = 'PO_NUMBER'] PARAMETER_LIST/PARAMETER_LIST_ITEM / VALUE

    Refer to:
    http://www.w3schools.com/XPath/xpath_syntax.asp

    See you soon,.
    Vlad

    Give points - it's good etiquette to reward an answering machine (5 - useful; 10 - correct) points for their position if they answer your question. If you think it's useful, please consider giving points

  • The default value based on the field from another table to a custom object

    I'm trying to set the default value to a field in the custom object to the value of a field of account. I tried the syntax 50 ways different and just don't get the case. The label for the account field displays the form of s/n, the integration of the tag is ltDBA_ACCT and it appears in the fx reports area as Account.Text_22.

    The field of custom object that I am triying update is also called s/n, which was originally the required field 'NAME '. The name of the table, account, should it be included? Do I need a function to the field?

    I've updated the external ID using the line with syntex < ID > ID (at least higher ID) so I know that it is possible to define a default value, but s / < n >, < ltDBA_ACCT >, 'account '. "" S/n "and so on are simply not working.

    If anyone knows how to get into what I would be really grateful for the help.

    OK, so if you default a field to the value of another object, you must use the JoinFieldValue function. I think you understand that, based on your original post, but I want to be sure you do.

    Then this won't work by default if the folder is created from the object that you want to join the because a default works in record creation and the ID must be available so that it works correctly. It will not work if you choose the record of the related object after that registration of the custom object is created. You can set the default after, but that does not meet your requirements.

    The syntax of the default are the following: JoinFieldValue (ref_record_type, foreign_key, field_name).

    In your case, ref_record_type is '', foreign_key is [] and field_name is ''. The best way is to determine what is the name of the field to create a new workflow for the account and use the Workflow Rule Condition expression builder to choose your field ("DBA") in the list. The value returned by the expression builder must be placed in the field_name variable in the function JoinFieldValue (minus the parentheses and quotes).

    Give it a shot and let me know how you do.
    Thom

  • Turn off the cell table based on the contents of another cell

    Hello

    Using JDeveloper 12.1.2.3 and have a table where I want to disable a cell in the row, based on a value in another cell (in the same line) and vica versa, IE are mutually exclusive.

    The photo below shows the two cells that need to be mutually exclusive. I have implemented this by setting the "Disabled" field to something like that

    "#{row.bindings.LineOfBusiness.inputValue ne ""}"
    

    I also put the autosubmit = true and added a partial trigger for the other column cell.

    Should be simple enough, right.

    The problem is that it doesn't work and all lines is disabled.

    disablecell.png

    Any tips?

    It turns out that I needed to check on

    don't #{row.bindings.LineOfBusiness.inputValue ' 0'}

    for the selectOneChoice, then it worked.

  • Trying to update a field of contact based on the comparison of another field of contact

    Hi all: I hope you can show me the light.  I'm trying to update my contact record with a value based on the comparison of 2 contact fields.

    So, is there an easy way to update a contact record with the FieldA value where FieldA is superior to FieldB?

    I did some research and go home empty-handed.  Any ideas?

    Thanks for your help!

    Penny

    Hey Penny,.

    If you compare two numeric fields, you can use the connector of cloud of mathematical functions to find the highest value in a table (A, B, C) for example, or to return if A is greater than B and then update your specified contact field.

    I described how to find the highest value in this post a bit backward, but the images seem to have disappeared - (perhaps a person of Eloqua can restore them somehow?).

    http://topliners.Eloqua.com/message/3539#3539

    Also take a look at this data sheet of mathematical functions of the appcloud for more information!

    http://img.EN25.com/Web/Eloqua/DataSheet_CC_MathFunctions.PDF

    I hope this helps!

    Chris

  • Display of a field on the form of the user's profile based on the results of another field

    Hello

    I have a requrement in which I'm supposed to display a checkbox based on the selection of the value to the employee type drp down.

    Thus, for example, if the field of employee type is selected with a value of 'Entrepreneur', a box should appear on the user profile form. If the value is anythign to another aprt of the contractor, the form should not display this box.

    Any ideas if this can be achieved OOB or it would require customization to the JSPs?

    Thank you
    Aerts

    You can use ajax and DHTML to achieve this functioanlity. I've already implemented and it works very well.

    See you soon!

  • How to identify all the analyses using a filter based on the findings of another analysis

    How can I identify all analyses in the catalogue that contains a filter based on the results of the analysis another? Due to limitations on TimesTen, we remove all instances of the filter based on another feature of analysis completely.

    Christian Berg says:

    do research on the physical files in the file system

    A quick test, I guess you want to get the assuming you are on Linux, grep would be:

    oracle@demo:SampleAppWebcat () $ grep --files-with-matches --recursive '
    

    From there, you can identify the relevant analyses.

  • Fill a combobox based on the selection of another

    Hi all

    I have a combobox that is filled dynamically. I want to fill an another combox based on the selected item in the combobox first. I use PHP to manage the connection to the database. The drop-down list box cbDivision fills very well.

    Can someone point me in the right direction?

    Here is my code:
    [Bindable]
    public var selectedItem:Object;

    [Bindable]
    private var datalist: ArrayCollection collection;
    private void resultHandler(event:ResultEvent):void {}
    DataList = event.result.data.row;
    }
    [Bindable]
    private var datalist2:ArrayCollection;
    private void resultHandler2(event:ResultEvent):void {}
    Datalist2 = event.result.data.row;
    }

    "" < mx:HTTPService url = " http://127.0.0.1/getDivisions.php"
    ID = "xmlGetDivisions".
    showBusyCursor = "true".
    result = "resultHandler (Event)" "
    method = 'GET' / >

    "" < mx:HTTPService url = " http://127.0.0.1/getFacilities.php"
    ID = "xmlGetFacilities".
    showBusyCursor = "true".
    result = "resultHandler2 (Event)" "
    method = "POST" >
    < mx:request xmlns = "" >
    < DivisionValue >
    {selectedItem.Division}
    < / DivisionValue >
    < / mx:request >
    < / mx:HTTPService >

    "< mx:ComboBox ="116"x ="60"id ="cbDivision"editable ="false"active = 'true' prompt = 'Please select' close ="selectedItem = ComboBox (event.target) .selectedItem, xmlGetFacilities.send ();"initialize =" getDivisions () "dataProvider ="{datalist}"= 'Division' labelField >
    < / mx:ComboBox >

    < mx:ComboBox = "413" x = "60" id = "cbFacility" editable = "false" enabled = "true" initialize = "xmlGetFacilities.send (); ' prompt = "Please sΘlectionner" dataProvider = "{datalist2}" labelField = "Name" > < / mx:ComboBox >


    Thank you in advance!

    No need to answer. I have it working now. It turns out that it was a problem with my PHP code.

  • Change the color of cell based on the text in another cell.

    Hey everybody, hoping that I can get some advice. I searched autour and finds only advice exceeded on a previous version of a number.

    I use 3 numbers

    Very simple question, in the hope of a simple answer

    Above is what I want the result to be.

    The "Number" column is a pop-up menu with a list of different text. I wish that the color of cell status change depending on which element is selected.

    I looked in the conditional highlighting, but it doesn't seem to be what I'm after. I would be able to get this working with formulas or a mixture of both?

    Thanks in advance for your help.

    Hi .adams,

    I do not understand the cells that you compare to get a color. It is a cell in the left column or a cell in the right column?

    Please tell us your overall goal: 'what' you want to do, rather than "how" to achieve this.

    More information, will lead to a solution.

    Kind regards

    Ian.

  • Start the virtual machine based on the load of another virtual machine

    Hi all

    I am looking for a solution that will start the VM on request depending on the load on the other virtual machines, perhaps in the same resource pool. Essentially, the expected result would be something like this:

    -When the dv01 reaches 75% CPU usage for 15 minutes,

    -Boot VM02

    -Once dv01 was less 40% use for 30 minutes,

    -Close the VM02

    This could also be a new virtual machine that is upwards of a model and Sysprep, rather than one that just sits there, offshore and unused.

    I hope that the final objective is clear. Does anyone have recommendations on how to do it? I just did a quick search on certain clauses that I thought would be relevant and did not really turn anything upwards.

    Thanks for your comments!

    -James

    jamesgreen wrote:

    Hi all

    I am looking for a solution that will start the VM on request depending on the load on the other virtual machines, perhaps in the same resource pool. Essentially, the expected result would be something like this:

    -When the dv01 reaches 75% CPU usage for 15 minutes,

    -Boot VM02

    -Once dv01 was less 40% use for 30 minutes,

    -Close the VM02

    This could also be a new virtual machine that is upwards of a model and Sysprep, rather than one that just sits there, offshore and unused.

    I hope that the final objective is clear. Does anyone have recommendations on how to do it? I just did a quick search on certain clauses that I thought would be relevant and did not really turn anything upwards.

    Thanks for your comments!

    -James

    with raise vm02, you can set the alarm action to run a script that will start vm02.

    PowerCLI command would be

    Start-VM - vm VM02

    you could probably add an alarm if dv01 has a less than 40% cpu

    run another script

    the command is:

    stop-vmguest - vm-VM02

  • Filling of textfield based on the input of another textfield

    Hi guys,.

    I have a problem.

    I have a textfield and the input of information in which must be completed in antother textfield. It seems easy, but the trick is. For each new entry a new textfield should appear with this information. My problem is that it creates a textfield, but for every letter I type in and not to a string when I press ENTER.

    See attached example.

    I hope you can help me!

    Thank you

    Diana

    This is the code: (I can't reach the example for some reason any) Table_SF._Repeat_SF.addInstance (1); xfa.resolveNode "(Table_SF. ("Repeat_SF [" + (Table_SF._Repeat_SF.count - 1) + ' "] '). TextField1.rawValue = xfa.event.newText;

    Instead of placing the code in the event changes, copy it to the Exit event.

    Table_SF._Repeat_SF.addInstance (1);

    xfa.resolveNode "(Table_SF. ("Repeat_SF [" + (Table_SF._Repeat_SF.count - 1) + ' "] '). TextField1.rawValue = this.rawValue;

    Thank you

    Srini

  • Changing the speed of a layer of Quicktime, based on the speed of another layer

    Hi everyone I'm new to expressions.

    I'm trying to change the speed of a layer of a quicktime movie. The speed at which he plays should reflect the velocity of another object. Faster, this object moves, the faster the film quicktime plays and vice versa.

    For some reason, adding an expression to time remapping done to work for speed.

    Any help would be appreciated

    Try to set the variable 'factor' to a smaller number.

    Dan

  • Auto create the value of a given field based on the range of percentage in another area

    Hello, people forum!  I am trying to create a field that fills a score based on the percentage in another area.  To this end, I have a field that autocalculates a percentage based on two other fields.  I would be close to a third field which, for example, the rate less 75% 2... 75 - 85% 3... and more than 85% 4.  I can't understand the syntax to make it happen, can anyone of you help?

    For the edification, my percentage field looks like:

    Calculation of the percentage of rock - use the number Format "percentage".

    If (this.getField("RockTotalQ").value == 0) {}
    Event.Value = 0;
    } else {}
    Event.Value = this.getField("RockComplQ").value/this.getField ("RockTotalQ") .value;
    }

    Thank you.

    You can use something like this than the calculation script custom in the other field (make sure that it appears after the 'Percentage of Rock' field in the calculation order, if!):

    var v = this.getField("Rock Percentage").valueAsString;
    if (v=="") event.value = "";
    else {
        v = Number(v);
        if (v<=0.75) event.value = 2;
        else if (v<=0.85) event.value = 3;
        else event.value = 4;
    }
    
  • Checkbox validation based on the selection of the values LOV

    I'm trying to validate a checkbox custom on the opportunity page, based on the selection of the values LOV.

    For example only when the user selects 'rating = A', the box should be able to select and save.

    If the user selects other that 'A' in the field assessment, the box should not save.

    or

    Is it possible to do, the READ ONLY checkbox, enable only when the side 'A' is selected.

    Any thoughts / help on this.

    Thank you, Kumar

    Edited by: user10833334 may 4, 2010 06:43

    There is no function to make a read-only field based on the contents of another field, it is not an option. I will list my thoughts on how you might handle this below.

    -Option 1: I recommend that you use validation to manage it. I don't know exactly to your needs, but you could write a field validation that checks to see if the flag is checked and rating <>has and sends an error message to the user, if it is not. The user would not be able to save the file until it Unchecks the box or sets the side = A.
    Advantages: User gets a message explaining the problem with the data and is forced to fix it before you save it.
    Cons: Requires interaction from the user to save and if they do not pay attention, the data may be lost if they cancelled without saving the changes.

    -Option 2: Another option would be to use the workflow to validate the registration. In this scenario, you can create a workflow that determines whether the field is out of adjustment, and if it is not correctly set, the workflow would update the box accordingly. In this scenario, you would use the 'Actions if Condition is False' also to inform the user that the flag cannot be controlled unless the side =. Then, you must set the Action "Update the values" update the uncontrolled field.
    Pros: Manages the work without user interaction.
    Cons: The con in this case, is that there is no workflow 'Before NEW record saved' trigger, so it is likely that the user sets the value incorrectly when creating the folder and it would stay like that until they update the record again.

    Some people might argue that there is another option that uses the functionality of dynamic page layout to make the field read-only, but this isn't a good option. You would need to convert using the Type of the opportunity in a way that would make use of the possibilities of lourdes for your users and I mention it only to you recommend to avoid his review completely.

    Good luck and let me know if you have any questions.
    Thom

  • To access the elements of an array of elements based on the value of the attribute

    Hi all

    I create a BPEL 11 g process that calls a web service which returns a data table. I need iterator on the data elements and access based on their attribute value.

    Here is a sample web service load:

    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
       <env:Header/>
       <env:Body>
          <OutputParameters xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.oracle.com/apps/inv/soaprovider/plsql/item_pub/get_item/">
             <GET_ITEM>
                <Row>
                   <Column name="ORGANIZATION_ID" sqltype="NUMBER">101</Column>
                   <Column name="ORGANIZATION_CODE" sqltype="VARCHAR2">MyOrg</Column>
                   <Column name="SEGMENT1" sqltype="VARCHAR2">MySegment</Column>
                   <Column name="DESCRIPTION" sqltype="VARCHAR2">Upload 445</Column>
                   <Column name="PRIMARY_UNIT_OF_MEASURE" sqltype="VARCHAR2">Each</Column>
                   <Column name="PRIMARY_UOM_CODE" sqltype="VARCHAR2">EA</Column>
                   <Column name="ITEM_CREATION_DATE" sqltype="VARCHAR2">01/21/2014 09:22:35</Column>
                   <Column name="ITEM_UPDATE_DATE" sqltype="VARCHAR2">01/21/2014 09:22:35</Column>
                   <Column name="REVISION" sqltype="VARCHAR2">0</Column>
                   <Column name="REVISION_LABEL" sqltype="VARCHAR2">0</Column>
                   <Column name="REV_CREATION_DATE" sqltype="VARCHAR2">01/21/2014 09:22:57</Column>
                   <Column name="REV_UPDATE_DATE" sqltype="VARCHAR2">01/21/2014 09:22:57</Column>
                </Row>
                <Row>
                   ...
                </Row>
                <Row>
                   ...
                </Row>
             </GET_ITEM>
          </OutputParameters>
       </env:Body>
    </env:Envelope>
    

    How can I get some columns based on the name of the column attribute?

    I tried to do this:

    bpws:getVariableData('getItemResponse','body','/ns7:OutputParameters/ns7:GET_ITEM/ns7:Row[$partIndex]/ns7:Column[@name='SEGMENT1'])
    

    and

    bpws:getVariableData('getItemResponse','body','/ns7:OutputParameters/ns7:GET_ITEM/ns7:Row[bpws:getVariableData('partIndex')]/ns7:Column[@name='SEGMENT1'])
    

    but I got this compilation error:

    Error (157): xpath expression "bpws:getVariableData ('getItemResponse', 'body','/ ns7:OutputParameters / ns7:GET_ITEM / ns7:Row [bpws:getVariableData('partIndex')] / ns7:Column [@name = 'SEGMENT1'])" appearing is not valid, because XPath query syntax error. The syntax error occurs when parsing bpws:getVariableData ('getItemResponse', 'body','/ ns7:OutputParameters / ns7:GET_ITEM / ns7:Row [bpws:getVariableData('partIndex')] / ns7:Column [@name = 'SEGMENT1']) expression XPath, posted on 112. The XPath query syntax was false; the exception was: anticipated :). Check the detailed origin described in the text of the exception message and verify that the XPath expression that is named in the error message is correct. The XPath expression is defined in the BPEL process.

    I use JDeveloper 11.1.1.7.0

    Thanks in advance,

    Bill

    Use an entitlement and copy node and you can get it to work by using the syntax below.

    Assign an expression of the copy below syntax: -.

     

           

    Query="/ns1:GET_ITEM/ns1:row[$index]/ns1:column[./@name='Segment1']"/ >

           

         

    Query = "" / client: processResponse / client: result "/ >"

Maybe you are looking for