Query for unique id with XDocument

I have the following XML name Sample.xml which I am trying to query uniqueID with XDocument:
<Request>
<Person xmlns="http://CompanyName.AppName.version1" uniqueID="3221">
<AccountNo>83838</AccountNo>
<FirstName>Tom</FirstName>
<LastName>Jackson</LastName>
</Person>
<Person xmlns="http://CompanyName.AppName.version1" uniqueID="21132">
<AccountNo>789875</AccountNo>
<FirstName>Chris</FirstName>
<LastName>Smith</LastName>
</Person>
</Request>
How do i write code to extract uniqueID of all person please help 

Try this:
XDocument xd = ...
var result = xd
.Root
.Elements( "{http://CompanyName.AppName.version1}Person" )
.Select( p => p.Attribute( "uniqueID" ).Value );
If you need immediately an array or list, then also call
ToArray() or ToList().

Similar Messages

  • How to create sql query for item master with operator LIKE with variables?

    hi all,
    How to create sql query for item master with
    operator LIKE(Contains,Start With,End With) with variables using query generator in SAP B1 ?
    Jeyakanthan

    Hi Jeyakanthan,
    here is an example (put the like statement into the where field)
    SELECT T0.CardCode, T0.CardName FROM OITM T0 WHERE T0.CardName Like '%%test%%'
    The %% sign is a wildcard. If you need start with write 'test%%' and otherwise ends with '%%test'. For contains you need '%%test%%'. You also could combinate this statements like 'test%%abc%%'. This means starts with test and contains abc.
    Regards Steffen

  • Query for spatial data with a GeometryCollection fails

    There are exact 538 CurvePolygons (only exterior rings at this
    sample). All of them are valid geometries and equal in dimension
    and so on. Now I connect them to a GeometryCollection and query
    for other relating spatial data in some tables. It seems that
    the use of around (not exact!) 200 CurvePolygon in one
    GeometryCollection works fine but the adding of more
    CurvePolygon result in an error with the Spatial Index (I could
    add the ORA- error numbers if I have some data in my test tables
    again next days).
    Is there anybody else having trouble with these mysterious
    problem? Maybe there is a border by the number of points in
    GeometryCollection?
    (More details, programming code could be delivered)
    (working with Java 1.3.1, oracle.sdoapi.*, Oracle 8.1.7.)

    Hi Lutz,
    Could you provide more info or samples of what is going wrong?
    Also, could you try making sure the geometry you are passing in
    as the query window is valid (i.e. instead of passing it in as a
    query window, pass it into sdo_geom.validate_geometry).
    Thanks,
    Dan

  • Why can't i use "INNER JOIN" in a query for SQL Server with JDBC??????

    Hi,
    I'm trying to execute some SQL queries and I just don't understand what's wrong.
    I�m using Tomcat and SQL Server in order to do this, but when I�m try to execute a query with a INNER JOIN statements Tomcat raise a SQL exception... at the very first time I thought there was a problem with database connection but I realize that a simple query to a table works pretty well. then I found out some problems with JDBC:ODBC.... so I install JDBC for SQL Server 2000 and test with the same simple query and works..... so, I come to a conclusion.... INNER JOIN or JOIN statements can't be used in JDBC..... please... somebody tell I�m wrong and give me a hand...
    I'm using TOMCAT 4 and JDK 1.4 SQL Server 2000
    Error occurs when executeQuery() is called.... not prepareStatement().... ??????
    Driver DriverRecResult = (Driver)Class.forName(driver).newInstance();
    Connection ConnRecResult = DriverManager.getConnection(DSN,user,password);
    PreparedStatement StatementRecResult = ConnRecResult.prepareStatement(query);
    ResultSet RecResult = StatementRecResult.executeQuery(); <---- Exception raise here
    So much tahnks in advance,

    That's exactly what I think, driver it's raising the exception, but I don't know why.... i test the same query with INNER JOIN directly from SQL Query Analyser and it's works perfectly, my problem ain't SQL, but JSP and JDBC 'cause i'm a newbie about these issues.
    Common sense tell me possible problems lie in SQLServer drivers 'cause i run the same pages on JRUN through jdbc:odbc and do works well, but by now i just depend on Tomcat.....
    I've installed SQL Server drivers for JDBC but i just find it doesn't work fully... could be the version of JDK i've installed? what version do i need?
    ( I'm running Tomcat 4 with JDK 1.4 & SQL Server 2000 W2K )
    thanks for reply.

  • Query for onhand  qunatity  with particular date  for eam

    hi all ,
    following query are showing wrong value for on hand quantity with particular date mean work order issue date for quantity .
    can u show me where is problem in this query.
    SELECT   ood.organization_name, wrov.concatenated_segments item_number,
             wrov.item_description description, wrov.item_primary_uom_code uom,
            -- SUM (on_hand.on_hand) quantity_in_stock,
              SUM (on_hand.on_hand) + wrov.quantity_issued quantity_in_stock,
             we.wip_entity_name work_order_number,
             TRUNC (we.creation_date) work_order_date,
             fu.user_name work_order_made_by, wrov.quantity_issued,
             trunc(cic.material_cost,2) issue_rate_per_qty,
             wrov.quantity_issued * trunc(cic.material_cost,2) quantity_value,
             --SUM (on_hand.on_hand) - wrov.quantity_issued balace_qty,
             SUM (on_hand.on_hand)  balace_qty,
               SUM (on_hand.on_hand)
             * trunc(cic.material_cost,2) COST,
             eam.ATTRIBUTE1 EQUIPEMENT_NO
            --  gcc.SEGMENT6 equipement_no
        FROM wip_entities we,
             wip_requirement_operations_v wrov,
             org_organization_definitions ood,
             mtl_onhand_total_mwb_v on_hand,
             fnd_user fu,
             cst_item_costs cic,
             eam_work_orders_v eam
    --                    gl_code_combinations gcc,
    --                    WIP_TRANSACTION_ACCOUNTS  wta ,
    --                    WIP_TRANSACTIONS wt
       WHERE wrov.wip_entity_id = we.wip_entity_id
         AND ood.organization_id = wrov.organization_id
         AND wrov.inventory_item_id = on_hand.inventory_item_id
         AND on_hand.organization_id = ood.organization_id
         AND we.created_by = fu.user_id(+)
         AND cic.inventory_item_id = wrov.inventory_item_id
         AND cic.organization_id = wrov.organization_id
         --AND we.wip_entity_name = '179542'
         AND wrov.organization_id = nvl(:organization_id,wrov.organization_id)
                AND (we.wip_entity_name = :job_order_No OR :job_order_No IS NULL)
                and trunc(we.creation_date) between  nvl(:from_date ,trunc(we.creation_date)) and nvl(:too_date ,trunc(we.creation_date))
               and eam.WIP_ENTITY_NAME=we.wip_entity_name
               and eam.WORK_ORDER_STATUS in('Complete','Complete - No Charges' ,'Released')
    --                 and gcc.CODE_COMBINATION_ID  =wta.REFERENCE_ACCOUNT
    --                 and wta.TRANSACTION_ID =wt.TRANSACTION_ID
    --                 and we.wip_entity_id  =wta.WIP_ENTITY_ID
    GROUP BY ood.organization_name,
             wrov.concatenated_segments,
             wrov.item_description,
             wrov.item_primary_uom_code,
             we.wip_entity_name,
             we.creation_date,
             fu.user_name,
             wrov.quantity_issued,
             cic.material_cost,
              eam.ATTRIBUTE1
           --  gcc.SEGMENT6
           order by we.wip_entity_name

    I don't think there is any special predicate to do that, Code is simply getting all children of given asset and returning them (Offcource there is some ordering logic). If You want exact informaiton I would suggest to use json call that DAM is making i.e.
    HOST:POST/<PATH OF DAM>.assets.json
    Or decompile AssetListServlet.java ans see how it is implemeted
    Yogesh
    www.wemblog.com

  • Query For Retrieving Data With Date and grouping

    Hi Guys
    I am having a hard time to figure out the sql query.
    I have a table with data. Below is the illustration.
    date location  item description
    1 jan 14 A  apple desc1
    2 jan 14 A  apple desc2
    3 jan 14 B  apple desc1
    4 jan 14 B  apple desc2
    1 jan 14 A  orange desc1
    2 jan 14 A  orange desc2
    3 jan 14 B  orange desc1
    4 jan 14 B  orange desc2
    My question it how to get the latest date on each location and item along with the description field
    This is the result I want
    date location  item description
    2 jan 14 A  apple desc2
    4 jan 14 B  apple desc2
    2 jan 14 A  orange desc2
    4 jan 14 B  orange desc2
    Thanks.

    provided it a datetime/date field you've for date you can do this
    SELECT [date],location,itemdescription
    FROM
    SELECT [date],location,itemdescription,
    ROW_NUMBER() OVER (PARTITION BY location ORDER BY [date] DESC) AS Rn
    FROM table
    )t
    WHERE Rn = 1
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • SCCM Query for any PC with 2 partitions?

    I'm trying to find a query that will allow me to tell any computer in our network that has 2 partitions.  When we deploy our Win7 through SCCM it has only the 1 partition and doesn't have the 100MB partition that is created if you install via a CD. 
    Problem is we have some old 7 computers that we need to find to change the way we deploy bitlocker and MBAM through SCCM and if i can find the ones with 2 partitions then I'll have a much easier job.  Does anyone know how to do that via SCCM?

    Hi, This query will list all computers with a disk 0 parition 1, that should mean they have two partitions. I got some strange result on one of my HP Laptops though which had 4, But you could give it a try.
    select SMS_R_System.Name, SMS_G_System_PARTITION.DeviceID from SMS_R_System inner join SMS_G_System_PARTITION on SMS_G_System_PARTITION.ResourceId = SMS_R_System.ResourceId where SMS_G_System_PARTITION.DeviceID = "Disk #0, Partition #1"
    Regards,
    jörgen
    -- My System Center blog ccmexec.com -- Twitter @ccmexec

  • How to query for XML-attribute with XPATH

    Hi,
    Isn't there somebody, who can tell me how to query an Attribut of an XML-element correctly ?
    All my trials lead to empty rows. What's worng in my XPATH-expresion ?
    XML-file looks like this:
    <?xml version="1.0" encoding="UTF-8"?>
    <xmlexport>
    <itsystem guid="e51b91d1-ab0f-11db-2cd7-001641105333">
    <field fieldidentifier="currentVersion" />
    <field fieldidentifier="marketdatacosts">0</field>
    I can query fine the elements and sub-elements, but not attribute 'guid' of /xmlexport/itsystem. Here some trials, all lead
    SELECT t.* FROM CORIA."xmlexport156_TAB", xmltable ('/xmlexport/itsystem ' passing object_value COLUMNS
    GUID     VARCHAR2(1000) path '[@guid=*]') t
    various versions for Xpath:
    path '[@guid="*"]'
    path '/[@guid=*]'
    path '[@guid=*]'
    xmltable ('/xmlexport' ...
    path '/itsystem/[@guid=*]'
    ... combinations of part 1 and 2
    thanks for any hint, LaoDe

    You can either get them directly, or fetch the attribute in your xquery and put them in returning xml fragment, then get them like normal element.
    Method #1:
    path '@guid'
    Method #2:
    xmltable(
    let $is := /xmlexport/itsystem
    return <r><guid>{$is/@guid}</guid></r>
    passing object_value
    columns guid varchar2(1000) path '/r/guid')

  • Query For Retrieving Data With Date

    Hi Guys
    I am having a hard time to figure out the sql query.
    I have a table with data. Below is the illustration.
    date location
    item
    1 jan 14 A
    apple
    2 jan 14 A
    apple
    3 jan 14 B
    apple
    4 jan 14 B
    apple
    1 jan 14 A
    orange
    2 jan 14 A
    orange
    3 jan 14 B
    orange
    4 jan 14 B
    orange
    My question it how to get the latest date on each location and item
    This is the result I want
    date location
    item
    2 jan 14 A
    apple
    4 jan 14 B
    apple
    2 jan 14 A
    orange
    4 jan 14 B
    orange
    Thanks.

    Try the below:
    create table #temp (sdate datetime,location char(1),Item varchar(20))
    insert into #temp values('1 jan 14','A','Apple')
    insert into #temp values('2 jan 14','A','Apple')
    insert into #temp values('3 jan 14','B','Apple')
    insert into #temp values('4 jan 14','B','Apple')
    insert into #temp values('1 jan 14','A','Orange')
    insert into #temp values('2 jan 14','A','Orange')
    insert into #temp values('3 jan 14','B','Orange')
    insert into #temp values('4 jan 14','B','Orange')
    ;With cte as
    Select * , Row_Number()Over(partition by location, item order by sdate desc) Rn
    From #Temp
    Select * From cte Where rn=1 Order by Item asc,location asc
    drop table #temp

  • Require query for unique data?

    hi,
    i have a partitioned table which has some data.
    i want to get unique data for a combination of columns.
    i want to get unique data for the combination of cid, lid in the table cdi_post_curr...
    if i use select distinct cid, lid from table...
    then can i get the correct data....
    and this table also has some address fields like address1, address2, zip1, zip 2 and i want to find the unique data on teh combintaiton of these columns...
    SELECT all_data.lid,
    NVL(all_data.STREET_LN1_ADDR, 'NULL'),
    NVL(all_data.STREET_LN2_ADDR, 'NULL'),
    NVL(all_data.CTY_ADDR, 'NULL'),
    NVL(all_data.POST_ZIP5_CD, 'NULL'),
    NVL(all_data.POST_ZIP4_CD, 'NULL'),
    NVL(all_data.GEO_ZIP_CD, 'NULL'),
    NVL(all_data.LAT_NO, 0),
    NVL(all_data.LNG_NO, 0),
    NVL(all_data.LAT_LNG_CD, 0)
    FROM CDI_POST_HCP_ALL_DATA_CURR all_data
    in this i want unique data for all these address fields...
    please help me guys...
    Edited by: pusala on Dec 7, 2010 3:53 PM

    SELECT
    NVL(all_data.STREET_LN1_ADDR, 'NULL'),
    NVL(all_data.STREET_LN2_ADDR, 'NULL'),
    NVL(all_data.CTY_ADDR, 'NULL'),
    NVL(all_data.POST_ZIP5_CD, 'NULL'),
    NVL(all_data.POST_ZIP4_CD, 'NULL'),
    NVL(all_data.GEO_ZIP_CD, 'NULL'),
    NVL(all_data.LAT_NO, 0),
    NVL(all_data.LNG_NO, 0),
    NVL(all_data.LAT_LNG_CD, 0),
    count(*)
    FROM CDI_POST_HCP_ALL_DATA_CURR all_data
    group by NVL(all_data.STREET_LN1_ADDR, 'NULL'),
    NVL(all_data.STREET_LN2_ADDR, 'NULL'),
    NVL(all_data.CTY_ADDR, 'NULL'),
    NVL(all_data.POST_ZIP5_CD, 'NULL'),
    NVL(all_data.POST_ZIP4_CD, 'NULL'),
    NVL(all_data.GEO_ZIP_CD, 'NULL'),
    NVL(all_data.LAT_NO, 0),
    NVL(all_data.LNG_NO, 0),
    NVL(all_data.LAT_LNG_CD, 0)If you only want the values where there are duplicates then use
    SELECT
    NVL(all_data.STREET_LN1_ADDR, 'NULL'),
    NVL(all_data.STREET_LN2_ADDR, 'NULL'),
    NVL(all_data.CTY_ADDR, 'NULL'),
    NVL(all_data.POST_ZIP5_CD, 'NULL'),
    NVL(all_data.POST_ZIP4_CD, 'NULL'),
    NVL(all_data.GEO_ZIP_CD, 'NULL'),
    NVL(all_data.LAT_NO, 0),
    NVL(all_data.LNG_NO, 0),
    NVL(all_data.LAT_LNG_CD, 0),
    count(*)
    FROM CDI_POST_HCP_ALL_DATA_CURR all_data
    group by NVL(all_data.STREET_LN1_ADDR, 'NULL'),
    NVL(all_data.STREET_LN2_ADDR, 'NULL'),
    NVL(all_data.CTY_ADDR, 'NULL'),
    NVL(all_data.POST_ZIP5_CD, 'NULL'),
    NVL(all_data.POST_ZIP4_CD, 'NULL'),
    NVL(all_data.GEO_ZIP_CD, 'NULL'),
    NVL(all_data.LAT_NO, 0),
    NVL(all_data.LNG_NO, 0),
    NVL(all_data.LAT_LNG_CD, 0)
    having count(*) > 1

  • Need help to write a query for Update statement with  join

    Hi there,
    The following update statement gives me error as the given table in set statement is invalid. But its the right table .
    Is the statement correct? Please help .
    update (
           select distinct(vpproadside.VEHICLE_CRED_OVERRIDE.vin)            
             from vpproadside.VEHICLE_CRED_OVERRIDE
             join vpproadside.vpp_vehicle
               on vpproadside.vpp_vehicle.vin = vpproadside.VEHICLE_CRED_OVERRIDE.vin
            where VPP_CARRIER_SEQ_NUMBER = 90
              and EXPIRY_DATE = '17-MAR-10'
       set vpproadside.VEHICLE_CRED_OVERRIDE.EXPIRY_DATE = '15-SEP-10';Edited by: Indhu Ram on Mar 12, 2010 1:00 PM
    Edited by: Indhu Ram on Mar 12, 2010 1:22 PM
    Edited by: Indhu Ram on Mar 12, 2010 2:35 PM
    Edited by: Indhu Ram on Mar 15, 2010 8:04 AM
    Edited by: Indhu Ram on Mar 15, 2010 8:06 AM
    Edited by: Indhu Ram on Mar 15, 2010 8:28 AM

    Ask Tom has very good discussion about this, if UPDATE does not work for PK issue, you can use MERGE
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:760068400346785797

  • SAP query for asset report with retirement and depreciation retirement

    Hi Expert,
    Can anyone tell me in table ADA which filed is holding the figure of retirement and retirement depreciation?
    Thank oyu

    Hi,
    Max.
    For your question you can check the tables ANEP for asset transactions line items and for asset value fields you can check out ANLC.
    I hope this may help you.
    If you have any doubts feel free to ask.
    Regards,
    Pankaj A Bhalerao.

  • DELETE QUERY FOR A TABLE WITH MILLION ROWS

    Hello,
    I have a requirement where I have to compare 2 tables - both having around million rows, and delete data based on a single column.
    DELETE FROM TABLE_A WHERE COLUMN_A NOT IN
    (SELECT COLUMN_A FROM TABLE_B)
    COLUMN_A had index defined on it in both tables. Still it is taking a long time. What is the best way to achieve this? any work around?
    thanks

    How many rows are you deleting from this table ? If the precentage is large then the better option is
    1) Create a new table where COLUMN_A NOT IN
    (SELECT COLUMN_A FROM TABLE_B)
    2) TRUNCATE table_A
    3)Insert in to table_A (select * from new table)
    4) If you have any constraints then may be it can be diaabled.
    thanks

  • Query for invoice and distribution detail

    hi 2 all
    anybody have the query for getting invoice with distribution detail in oracle payable r12.
    thanks
    zulqarnain

    select ass.SEGMENT1 vendor_number,
    ass.VENDOR_NAME,
    assa.VENDOR_SITE_CODE VENDOR_SITE,
    aia.INVOICE_NUM,
    aia.INVOICE_DATE,
    aia.INVOICE_AMOUNT,
    aia.INVOICE_TYPE_LOOKUP_CODE,
    gcc.CONCATENATED_SEGMENTS distribution_account ,
    gcc1.CONCATENATED_SEGMENTS liability_account,
    to_char(aia.GL_DATE) GL_DATE,
    AP_INVOICES_PKG.GET_APPROVAL_STATUS( AIa.INVOICE_ID,
    AIa.INVOICE_AMOUNT, AIa.PAYMENT_STATUS_FLAG,
    AIa.INVOICE_TYPE_LOOKUP_CODE) APPROVAL_STATUS_LOOKUP_CODE
    from ap_invoices_all aia,
    ap_suppliers ass,
    ap_supplier_sites_all assa,
    ap_invoice_distributions_all aid,
    gl_code_combinations_kfv gcc,
    gl_code_combinations_kfv gcc1
    where aia.VENDOR_ID = ass.VENDOR_ID
    and assa.VENDOR_SITE_ID = aia.VENDOR_SITE_ID
    and ass.VENDOR_ID = assa.VENDOR_ID
    and aid.INVOICE_ID = aia.INVOICE_ID
    and aid.DIST_CODE_COMBINATION_ID = gcc.CODE_COMBINATION_ID
    and assa.ACCTS_PAY_CODE_COMBINATION_ID = gcc1.CODE_COMBINATION_ID
    --and aia.INVOICE_ID =  81000
    and aia.GL_DATE between '01-JAN-12' and '31-MAR-12'
    order by aia.GL_DATE
    Thanks,
    Atul

  • Query for PO Approval

    Dear Sir / Madam;
    Please Help, We try to made Query for PO Approval with condition if PO Type "ITEM" have to approve by Purchasing Manager, but for PO Type "SERVICE" have to approve by General Affair Manager.
    We Create Query for this condition " SELECT *  FROM OPOR  WHERE T0.[DOCTYPE]='I'
    We already create the stage, and this query is not work. But if try to set the total Doc greater than 1000000, it is work.
    Dear Sir / Madam, please help me to send me the right query ?
    Thanks for your help
    Regards
    Petrus

    Hi,
    I suggest to add select distinct 'true' or select 'true' for in your query like previous answer.
    Here are the solutions for your problem:
    A. for doc type is not as same as service :
    SELECT distinct 'true' FROM OPOR T0
    where $[OPOR.doctype] = N'S'
    B. For doctype is not as same as item:
    SELECT distinct 'true' FROM OPOR T0
    where $[OPOR.doctype] = N'I'
    Both have been tested and work well.
    Rgds,

Maybe you are looking for