How to select XML value for a namespace when multiple namespaces
Hi,
I'm a beginner with this, but I'm doing well with your help from this forum in a recent post selecting out all the detail from my xml
out into my oracle relational tables. Stumped, though, on how to select a value for xml tag value referenced by a defined namespace.
Version, XML, what I want to select, and attempted sql is below. Thanks in advance!
select * from V$VERSION
BANNER
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
PL/SQL Release 11.2.0.2.0 - Production
CORE 11.2.0.2.0 Production
TNS for Solaris: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production
drop table TRANSCRIPT;
create table TRANSCRIPT (
CONTENT xmltype
<?xml version="1.0" encoding="UTF-8"?>
<arb:AcademicRecordBatch xmlns:arb="urn:org:pesc:message:AcademicRecordBatch:v1.0.0">
<hst:HighSchoolTranscript xmlns:hst="urn:org:pesc:message:HighSchoolTranscript:v1.0.0" xmlns:ct="http://ct.transcriptcenter.com">
<TransmissionData>
<DocumentID>2013-01-02T09:06:15|D123456789</DocumentID>
</TransmissionData>
<Student>
<Person>
<Name>
<FirstName>John</FirstName>
<LastName>Doe</LastName>
</Name>
</Person>
<AcademicRecord>
<AcademicSession>
<Course>
<CourseTitle>KEYBOARD 101</CourseTitle>
<UserDefinedExtensions>
<ct:TranscriptExtensions>
<NCESCode>01001E010456</NCESCode>
<CourseRigor>1</CourseRigor>
</ct:TranscriptExtensions>
</UserDefinedExtensions>
</Course>
<Course>
<CourseTitle>SCIENCE 101</CourseTitle>
<UserDefinedExtensions>
<ct:TranscriptExtensions>
<NCESCode>01001E010457</NCESCode>
<CourseRigor>2</CourseRigor>
</ct:TranscriptExtensions>
</UserDefinedExtensions>
</Course>
</AcademicSession>
<AcademicSession>
<Course>
<CourseTitle>MATH 201</CourseTitle>
<UserDefinedExtensions>
<ct:TranscriptExtensions>
<NCESCode>01001E010458</NCESCode>
<CourseRigor>2</CourseRigor>
</ct:TranscriptExtensions>
</UserDefinedExtensions>
</Course>
</AcademicSession>
</AcademicRecord>
</Student>
</hst:HighSchoolTranscript>
</arb:AcademicRecordBatch>I want to be able to select the NESCODE associated to each coursetitle (01001E010456, 01001E010457, 01001E010458), with NESCode defined by namespace, but getting out NULL.
DOCUMENTID LASTNAME COURSETITLE NCESCODE
2013-01-02T09:06:15|D123456789 Doe KEYBOARD 101
2013-01-02T09:06:15|D123456789 Doe SCIENCE 101
2013-01-02T09:06:15|D123456789 Doe MATH 201
My SQL is below. You'll see where I commented out a couple failed alternatives too. Thanks again in advance for any guidance.
select x0.DocumentID
,x1.LastName
, x3.CourseTitle
,x3.NCESCode
from TRANSCRIPT t
, xmltable(
xmlnamespaces(
'urn:org:pesc:message:AcademicRecordBatch:v1.0.0' as "ns0"
, 'urn:org:pesc:message:HighSchoolTranscript:v1.0.0' as "ns1"
--, 'http://ct.transcriptcenter.com' as "ns1b"
, '/ns0:AcademicRecordBatch/ns1:HighSchoolTranscript'
passing t.content
columns DocumentID varchar2(40) path 'TransmissionData/DocumentID'
, Student xmltype path 'Student'
) x0
, xmltable(
'/Student'
passing x0.Student
columns LastName varchar2(20) path 'Person/Name/LastName'
,AcademicRecord xmltype path 'AcademicRecord'
) x1
, xmltable(
'/AcademicRecord/AcademicSession'
passing x1.AcademicRecord
columns GradeLevel varchar2(20) path 'StudentLevel/StudentLevelCode'
, Courses xmltype path 'Course'
) x2
, xmltable(
xmlnamespaces('http://ct.transcriptcenter.com' as "ns2b")
, '/Course'
passing x2.Courses
columns CourseTitle varchar2(40) path 'CourseTitle'
,NCESCode varchar2(20) path 'UserDefinedExtensions/ns2b:ct/NCESCode'
--,NCESCode varchar2(20) path 'UserDefinedExtensions/ns2b:ct/TranscriptExtensions/NCESCode'
) x3
<<I'm assuming there is more to your XML than you showed, since
StudentLevel/StudentLevelCode
is not in the XML, but is in your query. >>
Yes, to simplify, I left out some of the additional XML data, which is typically present, sorry for any confusion. I should have removed those references to that data in my example which was failing to retrieve the NCESCode data which was denoted by that namespace.
Thank you very much! Your correction worked. I was not understanding until your correction how to properly reference in the XPATH for that namespace value. I'm a newbie at this, and this is my second post. But I've been able to populate quite a few relational tables and that was the first of several namespace tags I will have to deal with next, and with that help, I should be good with that syntax now.
Thanks again for your help on this.
Similar Messages
-
How to select distinct values from a table when it has composite primary ke
Hi
I have the requirement like , I need to select distinct one column values from the table which has composite primary key. How to acheive this functioinality using view object.
Eg : Table 1 has col1 and col2, col3
col1 col2 col3
1 A NA
1 B NA
2 A NA
3 C NA
2 D NA
primary key (col1,col2)
I have to select distinct col1.
ThanksHi
I got the solution for above. By Creating the read only view object we can acheive this.
thanks -
How to set dynamic value for field Month when running background job ?
Dear guys,
I have a Z* report in our company, in the selection screen there is a period field (Month and Year) and this report running in background job periodically. My Question is how i can set for Month field become dynamic follow month value of date when this report executed ?
Example :
When Z* report running in background on 16.04.2008, Month Value will be 04 and when running on 16.05.2008, Month Value will be 05.
Please advice.
Regards
GunawanDear guys,
I have a Z* report in our company, in the selection screen there is a period field (Month and Year) and this report running in background job periodically. My Question is how i can set for Month field become dynamic follow month value of date when this report executed ?
Example :
When Z* report running in background on 16.04.2008, Month Value will be 04 and when running on 16.05.2008, Month Value will be 05.
Please advice.
Regards
Gunawan -
How to Select a value from DropDownByIndex -Urgent
Hi All,
I have dropdownbyindex UI elements in my Views, I get values from BAPI. When click records in a table, It goes to another view to display full record. Here i have dropdownbyIndexes So it should select one of appropriate value in dropdownbyindex based on record(Value) in table.
Example:
<u><i><b>In Table View</b></i></u>
id title status priority
10000 webDynPro New Low
<i><u><b>Detail View:</b></u></i>
id 10000
title webDynPro
Status New [New,Old,Open,Closed]---DropDownbyIndex
Priority Low [High,Low,Medium]---DropDownByIndex..4m BAPI
How to select Appropriate Values from DropdownbyIndex. if any one has sample code, that will be helpful.
Note: I am using Model Nodes
Thanks and Regards
Ravi GollaHi Ravi,
In details view, you will have corresponding context node created for Status and priority dropdown fields.
Let suppose, context node for Status is, StatusNode.
value attribute inside this is,
StatusNode
|_ StatusAttrib
Now, you need to write following code to set l_status ="LOW" value in it.
wdContext.nodeStatusNode().moveFirst();
for(int i=0; i<wdContext.nodeStatusNode().size(); i++)
if(wdcontext.currentStatusNodeElement().getStatusAttrib().equals(l_status)
wdContext.nodeStatusNode().setLeadselection(i);
break;
wdContext.nodeStatusNode().moveNext();
write same code for priority also.
Let me know if it is not working with you.
regards,
Bhavik -
How to insert / Update value for PFAKT in BP Relationship
Hi Friends / Experts,
How to insert the value for PFAKT ( Function value ) in BP Relationship in BP tcode , in SAP CRM.
I have tried it but it BAPI_BUPR_CONTP_CREATE. But I need it with BAPI_BUPR_RELATIONSHIP_CREATE Function Module.
Please help me out.
Any Enhancement points in BAPI_BUPR_RELATIONSHIP_CREATE or any user exists. Please let me know.
Regards,
KMF.you can also acheive this using MERGE( available in sql 2008 and above).
also, you are referring to DTS. DTS is legacy solution now..are you using sql 2000, you can use ssis, if you want and it available in sql 2005. as said, there are multiple ways you can do this.. it find the below one a easy solution, since your are
talking about only one table..
try this example..
create table test1(sno int primary key,sname varchar(20),scity varchar(20))
go
create table test2(sno int primary key,sname varchar(20),scity varchar(20))
go
insert into test1
values(1,'stan','atlanta'),(2,'william','newyork')
go
insert into test2
values(1,'robin','orlando')
go
--set this in you sql job and let it run for every half an hour
MERGE test2 t2
USING test1 t1
ON t2.sno = t1.sno
WHEN MATCHED THEN
UPDATE
SET t2.sname = t1.sname,t2.scity=t1.scity
WHEN NOT MATCHED by target THEN
Insert(sno,sname,scity)
values (sno,sname,scity);
go
--check this table and clean up
select * from test2
go
drop table test1
go
drop table test2
Hope it Helps!! -
How to set default values for boolean columns
I'm trying to deploy some content types and columns into a site with a feature. All it's ok, except that I'm trying to set a default value for boolean columns with no success.
I've tried to set default value at column level:
<Field ID="{EFE23A1D-494E-45cf-832E-45E41B17F0CF}" Name="ScopeSpanish" DisplayName="Se publican noticias en español"
Type="Boolean" Hidden="FALSE" Group="Columnas ShaCon" >
<Default>TRUE</Default>
</Field>
and at content type level:
<FieldRef ID="{EFE23A1D-494E-45cf-832E-45E41B17F0CF}" Name="ScopeSpanish" DefaultValue="TRUE" Required="TRUE" />
But in any case, when i create a new item with this content type, default value is applied.
Can anyone tell how to set default values for boolean columns?
Thanks in advance,
Regards,
SergioIn the field definition you can set
<Default>1</Default>
or
<Default>0</Default>
How to set the default value Null? -
A^b = n ,How to get the value for a ?
a^b = n ===> n = Math.pow(a,b)
How to get the value for a ?
dose Java have API to get the value for a ?
Thanks for help~~~a^b = n
=>
a = n^(1/b)
So,
a = Math.pow(n,1.0/b) -
Hello Guru,
could you please help with my issue with Fiori Installation.
We want to install SAP Fiori Front-End (GW+UI) on the Sandbox system with SAP Netweaver 7.3.1. (SP14)
Gateway component (SAP GW CORE 200 SP10) was installed without any problems.
But I need to install UI-add-on (NW UI Extensions v1.0) and when I try to install it via SAINT, transaction said me that I need to generate xml-file for it (as in General notes for UI add-on mentioned).
But I have Solution Manager 7.0.1 and in MOPZ for this version I do not have option "install Add-on" as it written in Guide for ui add-on installation.
Could you please help me with advice how to generate xml-file for UI add-on installation on SolMan v.7.0.1?
If where is no way, but only to upgrade Solution Manager, maybe somebody could give me xml-file for your system (for NW 731) and I will change it to my needs, I will be very grateful!
Thanks in advance for any help!!!
Bets regards,
Natalia.Hello Guru,
could you please help with my issue with Fiori Installation.
We want to install SAP Fiori Front-End (GW+UI) on the Sandbox system with SAP Netweaver 7.3.1. (SP14)
Gateway component (SAP GW CORE 200 SP10) was installed without any problems.
But I need to install UI-add-on (NW UI Extensions v1.0) and when I try to install it via SAINT, transaction said me that I need to generate xml-file for it (as in General notes for UI add-on mentioned).
But I have Solution Manager 7.0.1 and in MOPZ for this version I do not have option "install Add-on" as it written in Guide for ui add-on installation.
Could you please help me with advice how to generate xml-file for UI add-on installation on SolMan v.7.0.1?
If where is no way, but only to upgrade Solution Manager, maybe somebody could give me xml-file for your system (for NW 731) and I will change it to my needs, I will be very grateful!
Thanks in advance for any help!!!
Bets regards,
Natalia. -
How to define a Value for an Attribute of an Class
Hi,
How to define a Value for an Attribute of a Class ...
( I need to change the value of an Attribute of a class in standard program ....
Ex...
cl_hrce_masterswitches=>infotype_framework_is_active
Here infotype_framework_is_active is the attribute .. its value in standard program is 'X'... Now i need to change it as ' '.
How to define it and set value as ' '.Hello Surendar
The static attribute INFOTYPE_FRAMEWORK_IS_ACTIVE is read-only and there is not SETTER method to manipulate its value.
However, the attribute is filled in the CLASS_CONSTRUCTOR:
METHOD class_constructor.
IF ce_is_active = true OR
global_payroll_is_active = true OR
mngmt_global_empls_is_active = true.
infotype_framework_is_active = true.
perid_infotype_is_active = true.
ELSE.
infotype_framework_is_active = false.
perid_infotype_is_active = false.
ENDIF.
ENDMETHOD.
Thus, you need to analyze how attribute CE_IS_ACTIVE, GLOBAL_PAYROLL_IS_ACTIVE and MNGMT_GLOBAL_EMPLS_IS_ACTIVE are filled in the CLASS_CONSTRUCTOR.
For sure you will find customizing settings that are responsible for this.
Regards
Uwe -
How to calculate acquisition value for specified day
Hi,
in my z program I have a problem how to calculate acquisition value for my asset for specified day.
Example:
I have asset created 8.7.2008 with TTYPE 104 (External asset acquisition) with value 5950.
30.11.2008 there is another TTYPE 272 (Retirement of current-yr acquis., w/o revenue) with value 950.
So BEFORE 30.11.2008 acquisition value is 5950. After is 5000. Is there any function module (or something else) in SAP system where I can send asset number and date a it return to me acquisition value for that day?
Many thanks for any answer!Hi,
your suggestion means that I have to compute acquisition value by myself (sum all TTYPE 1** - sum all TTYPE 2**). So SAP does't provide such functionality (LDB ADA have it, because it can compute acquisitiob value for specific day)?
Mant thanks for answer -
How To select maximum Value in a specifieid field in internal table.
How To select maximum Value in a specifieid field in internal table?
Step : 1
Sort itab by <Field1> descending.
Just sort the internal table by the field.
STEP: 2
Then read the table at index 1.
Read table itab index 1.
ITAB-FIELD = MAX . " Max field will come in the first row of the internal table.
Regards,
Gurpreet -
Hi,
How to assign a value for Unit of measure (like PC, KG...) in ABAP program?
I want to assign PC in a field to execute the program, like wa-ENTRY_UOM = 'pc'.
But the system returen a message that "Unit of measure is not convertible to stockkeeping unit PC"
Could anyone tell me how to assign the value??
Thanks!hi,
first convert the quantity in the same unit ( like in you case ST to PC ) by using FM : MD_CONVERT_MATERIAL_UNIT
CALL FUNCTION 'MD_CONVERT_MATERIAL_UNIT'
EXPORTING
i_matnr = matnr
i_in_me = entry_uom
i_out_me = out_uom
i_menge = quantity
IMPORTING
E_MENGE = fp_l_v_quant
EXCEPTIONS
ERROR_IN_APPLICATION = 1
ERROR = 2
OTHERS = 3.
IF sy-subrc <> 0.
give error message here
ENDIF.
bcoz in ur program somewhere the quantities etc are compared and there units may be different... so that is why it is showing such error. so just convert convert the quantity in the same unit .
regards
rahul
Edited by: RAHUL SHARMA on Jun 17, 2009 9:31 AM -
NW04s(SP7/FEP7)-Select Filter value for HIER in 3.XBexAnalyzer doesn't work
Hi,
We went live with SPS 7/FEP 7 and we are having problem in 3.X Bex Analyzer with "Select Filter Value" for charcteristic having active hierarchy(in this case it is using time dependent hierarchy). (For Eg: Organization Unit)
If I inactivate the hierarchy for organization unit at query level and then execute the query, then "select filter value" works for Organization Unit.
NOTE: I checked other query using hierarchy (not time dependent hierarchy) and I was able to do "select filter value"
Please let me know if any OSS note is available for this issue so that we can fix this issue in our Production Environment.
NOTE: The above issue works in SPS 8/FEP 802 with 3.X Bex Analyzer.
Thankyou,
-Sini
Message was edited by: Sini KumarHi,
Did you have an asnwer to your problem?
We've a similar problem we had a technical upgrade to BI 7.0. But we still work with the frond end tools of 3.5.
When we select in the Bex analyzer a node in an hierarchy it shows the result, but if want to select an other node we must first remove the old filter. This wasn't when we're on the 3.5 enviroment.
Maybe if the problem is solved, this can help us.
Thanks in advance!
Regards,
Juriaan -
How to set defalut values for html:radio
Hi all,
can you please tell me how to set defalut values for radio buttons (html:radio) in struts?You may have more luck if you ask this Struts specific question in a forum devoted to Struts at their own homepage over there at apache.org. It may also help a lot to read its documentation and tutorials. I would really be surprised if they didn't even document such a trivial thing.
-
How to integrate bing map for including or displaying multiple locations at the same time
how to integrate bing map for including or displaying multiple locations at the same time
Have you aware of the geolocation field that's been introduced with SharePoint 2013? You can store location data within a list and then integrate this within Bing. The second tutorial on this Bing team blog will show it well.
https://www.bing.com/blogs/site_blogs/b/maps/archive/2013/03/26/connecting-a-sharepoint-list-to-bing-maps.aspx
Steven Andrews
SharePoint Business Analyst: LiveNation Entertainment
Blog: baron72.wordpress.com
Twitter: Follow @backpackerd00d
My Wiki Articles:
CodePlex Corner Series
Please remember to mark your question as "answered" if this solves (or helps) your problem.
Maybe you are looking for
-
Is there a way to expand all drop-down text in a single topic in the editor?
I'm going through all the topics in a large RH10 project manually checking various things. A lot of topics contain drop-down text and to view the contents, I'm having to right click on each one and select 'Drop-down text properties'. Which is taking
-
I install two portal and one infra. And Configuring Multiple Middle Tiers with a Load Balancing Router successfully. The origin portal virsion is 10.1.2. Now i want to update to 10.1.4 but have somthing wrong after I enter the update commond. Error m
-
8i Standard Edition - 8i Enterprise Edition
I have an application that is using 8i Standard Edition and I'd really like to try out the SQL "analytical functions" that I understand are only included in Enterprise. This is client-server app that I have both the client and server installed on a s
-
Best Way to Remove CS2 from Leopard?
Brief History I run a MBP with 10.5.6. I just purchased CS4 so CS2 has to go. I've read about the incompatibility between 10.5 and CS2 but have never had any trouble until I tried to remove CS2. I followed the removal instructions on the CD but ran
-
Select Top 10 when it includes a GroupBy
I frequently use Select Top 10... to test a query before running it on a large MSSQL database. Works fine, except when the query includes a Group By Clause when it then seems to take as long as not using Top 10. I suspect this is beause it is actuall