Extracting Values
Should be an easy question, but I can't figure this one out.
How do you extract the "item id" and "filename" portions of the following xml document?
with text as (
select
'<?xml version="1.0" encoding="utf-8" ?>
<resp stat="1">
<item id="1234" filename="home.txt"/>
</resp>' as data
from dual)
select data from text;Running 10.2.0.5 of the database.
For example :
SQL> with text as (
2 select
3 '<?xml version="1.0" encoding="utf-8" ?>
4 <resp stat="1">
5 <item id="1234" filename="home.txt"/>
6 </resp>' as data
7 from dual)
8 select x.*
9 from text t
10 , xmltable('/resp/item' passing xmltype(t.data)
11 columns item_id number path '@id'
12 , filename varchar2(30) path '@filename'
13 ) x
14 ;
ITEM_ID FILENAME
1234 home.txt
Similar Messages
-
For some business requirements, users want to extract values from a multi-value enabled lookup column
and add items to another list based on each separate value. In contrast, others want to find duplicate values in the list and merge associated values to a multi-value enabled column and then
add items to another list based on the merged value. All of these can be achieved using SharePoint Designer 2013 Workflow.
How to extract values from a multi-value enabled lookup column and add items to another list based
on each separate value using SharePoint Designer 2013.
Important actions: Loop Shape; Utility Actions
Three scenarios
Things to note
Steps to create Workflow
How to merge values to a multi-value enabled column and add item to another list based on the
merged value using SharePoint Designer 2013.
Important actions: Call HTTP Web Service; Build Dictionary
Things to note
Steps to create Workflow
How to
extract values from a multi-value enabled lookup column and
add items to another list based on each separate value using SharePoint Designer 2013.
For example, they have three lists as below. They want to
extract values from the Destinations column
in Lookup2 and add items to Lookup3 based on each country and set Title to current item: ID.
Lookup1:
Title (Single line of text)
Lookup2:
Title (Single line of text), Destinations (Lookup; Get information from: Lookup1 in Title column).\
Lookup3:
Title (Single line of text), Country (Single line of text).
Important action
1. Loop Shape: SharePoint Designer 2013 support two types of loops: loop n times and loop with condition.
Loops must also conform to the following rules:
Loops must be within a stage, and stages cannot be within a loop.
Steps may be within a loop.
Loops may have only one entry and one exit point.
2. Utility Actions: It contains many actions, such as ‘Extract Substring from Index of String’ and ‘Find substring in String’.
Three scenarios
We need to loop through the string returned from the look up column and look for commas. There are three
scenarios:
1. No comma but string is non-empty so there is only one country.
2. At least one comma so there is at least two or more countries to loop.
3. In the loop we have consumed all the commas so we have found the last country.
Things to note
There are two things to note:
1. "Find string in string (output to Variable:index)" will return -1 if doesn't find
the searched for string.
2. In the opening statement "Set Variable: Countries to Current Item:Destinations" set the return
field as "Lookup Values, Comma Delimited".
Steps to create Workflow
Create a custom list named Lookup1.
Create a custom list named Lookup2, add column: Destinations (Lookup; Get information from: Lookup1 in Title column).
Create a custom list named Lookup3, add column: Country (Single line of text).
Create a workflow associated to Lookup2.
Add conditions and actions:
Start the workflow automatically when an item is created.
Add item to Lookup2, then workflow will be started automatically and create multiple items to lookup3.
See the below in workflow History List:
How to merge values to a multi-value enabled column and add item to another list based on the
merged value using SharePoint Designer 2013
For example, they have three lists as below. They want to find duplicate values in the Title column in
Lookup3 and merge country column to a multi-value enabled column and then add item to lookup2 and set the Title to Current Item: Title.
Lookup1:
Title (Single line of text)
Lookup3:
Title (Single line of text), Country (Single line of text).
Lookup2:
Title (Single line of text), Test (Single line of text).
Important actions
"Call HTTP Web Service"
action: In SharePoint 2013 workflows, we can call a web service using a new action introduced in SharePoint 2013 named Call HTTP Web Service. This action
is flexible and allows you to make simple calls to a web service easily, or, if needed, you can create more complex calls using HTTP verbs as well as allowing you to add HTTP headers.
“Build Dictionary"
action:
The Dictionary variable type is a new variable type in the SharePoint 2013 Workflow.
The following are the three actions specifically designed for the Dictionary variable type: Build Dictionary, Count Items in a Dictionary and Get an Item from a Dictionary.
The "Call HTTP Web Service" workflow action would be useless without the new "Dictionary" workflow action.
Things to note
The
HTTP URI is set to https://sitename/_api/web/lists/GetByTitle('listname')/items?$orderby=Id%20desc and the HTTP method is set to “GET”. Then the list will be sort by Id in descending order.
Use Get
d/results(0)/Id form
Variable: ResponseContent (Output to
Variable: maxid) to get the Max ID.
Use Set
Variable: minid to Current List:ID to get the Min ID.
Use Copy from
Variable: destianation , starting at
1 (Output to
Variable: destianation) to remove the space.
Steps to create Workflow
Create a custom list named Lookup1.
Create a custom list named Lookup2, add column: Test (Single line of text).
Create a custom list named Lookup3, add column: Country (Single line of text).
Create a workflow associated to Lookup3.
Add a new "Build Dictionary" action
to define the http request header:
Add a Call HTTP Web Serviceaction, click on
this and paste your http request.
To associate the
RequestHeader variable, select the Call action property,
set the
RequestHeaders property to
RequestHeader:
In the Call action, click on
response and associate the response to a new
variable: ResponseContent (of type Dictionary).
After the Call action add Get item from Dictionary action to get the Max ID.
Add Set Workflow Variable action to get the Min ID.
Add Loop Shape (Loop with Condition) to get all the duplicate titles and integrate them to a string.
Create item in Lookup2.
The final Stage should look like this:
Start the workflow automatically when an item is created.
Add item to Lookup3, then workflow will be started automatically and create item to lookup2.
See the below in workflow History List:
References
SharePoint Designer 2013 - Extracting values from a multi-value enabled lookup column into a dictionary as separate items:
http://social.technet.microsoft.com/Forums/en-US/97d34468-1b53-4741-88b0-958472f8ca9a/sharepoint-designer-2013-extracting-values-from-a-multivalue-enabled-lookup-column-into-a
Workflow actions quick reference (SharePoint 2013 Workflow platform):
http://msdn.microsoft.com/en-us/library/jj164026.aspx
Understanding Dictionary actions in SharePoint Designer 2013:
http://msdn.microsoft.com/en-us/library/office/jj554504.aspx
Working with Web Services in SharePoint 2013 Workflows using SharePoint Designer 2013:
http://msdn.microsoft.com/en-us/library/office/dn567558.aspx
Calling the SharePoint 2013 Rest API from a SharePoint Designer Workflow:
http://sergeluca.wordpress.com/2013/04/09/calling-the-sharepoint-2013-rest-api-from-a-sharepoint-designer-workflow/GREAT info, but it may be helpful to note that when replacing a portion of the variable "Countries" with a whitespace character, you may cause the workflow to fail in a few specific cases (certain lookup fields will not accept this and will automatically
cancel). I only found this out when recreating your workflow on a similar, but much more complex list set.
To resolve this issue, I used another utility action (Extract Substring from Index of List) to clear out the whitespace. I configured it as "Copy from
Variable: Countries, starting at
1 (Output to Variable: Countries), which takes care of this issue in those few cases.
Otherwise, WOW! AWESOME JOB! Thanks! :) -
Extracting Values of a Field from a Database Table in SAP ECC System
Hi,
I downloaded Extracting Values of a Field from a Database Table in SAP ECC System Using MII 12.0
senario from sdn. I'm trying to do that senario in MII 12.05. But I have problem with section 6 in page 7 (you can supply senario from sdn)
"6- Under the loop of Repeater, use action u2018Rowu2019 to append just the string part of the WA which will display only values for field u2018Batchu2019"
I did not find WA elemen in Output element of Repeater_0
How can I create WA element?
Thanks.Cemil,
Set up a SAP JCo Interface action block. Use the RFC name RFC_READ_TABLE.
In the link editor map the table to "MARA", set RowCount to something small (20 is good sample size) and create an xml transaction property named FIELDS and copy the following into it:
<?xml version="1.0" encoding="UTF-8"?><FIELDS>
<item>
<FIELDNAME>MATNR</FIELDNAME>
<OFFSET/>
<LENGTH/>
<TYPE/>
<FIELDTEXT/>
</item>
<item>
<FIELDNAME>MTART</FIELDNAME>
<OFFSET/>
<LENGTH/>
<TYPE/>
<FIELDTEXT/>
</item>
<item>
<FIELDNAME>BSTME</FIELDNAME>
<OFFSET/>
<LENGTH/>
<TYPE/>
<FIELDTEXT/>
</item>
<item>
<FIELDNAME>XCHPF</FIELDNAME>
<OFFSET/>
<LENGTH/>
<TYPE/>
<FIELDTEXT/>
</item>
<item>
<FIELDNAME>DATAB</FIELDNAME>
<OFFSET/>
<LENGTH/>
<TYPE/>
<FIELDTEXT/>
</item>
</FIELDS>
Then link the Transaction.FIELDS to SAP_JCo_Interface_0.Request{/RFC_READ_TABLE/TABLES/FIELDS}. You may run into problems with two other fields and optionally they can be removed (set link type to remove xml). I usually remove them initially for testing. The two fields are:
SAP_JCo_Interface_0.Request{/RFC_READ_TABLE/INPUT/NO_DATA}
SAP_JCo_Interface_0.Request{/RFC_READ_TABLE/INPUT/DELIMITER} (or you can set this to something like a semicolon,";" or tilda,"~". I find it easier to caclulate position by length, but that is my own idiosyncrasy.)
Once you get this one working, we can explore how to do filtering on the dataset. Your output should be something like this:
<?xml version="1.0" encoding="utf-8"?>
<RFC_READ_TABLE>
<INPUT>
<DELIMITER />
<NO_DATA />
<QUERY_TABLE>MARA</QUERY_TABLE>
<ROWCOUNT>20</ROWCOUNT>
<ROWSKIPS>0</ROWSKIPS>
</INPUT>
<TABLES>
<DATA>
<item>
<WA>000000000000000023ROH 00000000</WA>
</item>
<item>
<WA>000000000000000038HALB 00000000</WA>
</item>
<item>
<WA>000000000000000043HAWA 00000000</WA>
</item>
<item>
<WA>000000000000000058HIBE 00000000</WA>
</item>
<item>
<WA>000000000000000059HIBE 00000000</WA>
</item>
<item>
<WA>000000000000000068FHMI 00000000</WA>
</item>
<item>
<WA>000000000000000078DIEN 00000000</WA>
</item>
<item>
<WA>000000000000000088FERT 00000000</WA>
</item>
<item>
<WA>000000000000000089FERT 00000000</WA>
</item>
<item>
<WA>000000000000000098HALB 00000000</WA>
</item>
<item>
<WA>000000000000000170NLAG 00000000</WA>
</item>
<item>
<WA>000000000000000178NLAG 00000000</WA>
</item>
<item>
<WA>000000000000000188NLAG 00000000</WA>
</item>
<item>
<WA>000000000000000288HALB 00000000</WA>
</item>
<item>
<WA>000000000000000358HAWA 00000000</WA>
</item>
<item>
<WA>000000000000000359HAWA 00000000</WA>
</item>
<item>
<WA>000000000000000521HAWA 00000000</WA>
</item>
<item>
<WA>000000000000000578FERT 00000000</WA>
</item>
<item>
<WA>000000000000000597HAWA 00000000</WA>
</item>
<item>
<WA>000000000000000598VERP 00000000</WA>
</item>
</DATA>
<FIELDS>
<item>
<FIELDNAME>MATNR</FIELDNAME>
<OFFSET>000000</OFFSET>
<LENGTH>000018</LENGTH>
<TYPE>C</TYPE>
<FIELDTEXT>Material Number</FIELDTEXT>
</item>
<item>
<FIELDNAME>MTART</FIELDNAME>
<OFFSET>000018</OFFSET>
<LENGTH>000004</LENGTH>
<TYPE>C</TYPE>
<FIELDTEXT>Material Type</FIELDTEXT>
</item>
<item>
<FIELDNAME>BSTME</FIELDNAME>
<OFFSET>000022</OFFSET>
<LENGTH>000003</LENGTH>
<TYPE>C</TYPE>
<FIELDTEXT>Purchase Order Unit of Measure</FIELDTEXT>
</item>
<item>
<FIELDNAME>XCHPF</FIELDNAME>
<OFFSET>000025</OFFSET>
<LENGTH>000001</LENGTH>
<TYPE>C</TYPE>
<FIELDTEXT>Batch management requirement indicator</FIELDTEXT>
</item>
<item>
<FIELDNAME>DATAB</FIELDNAME>
<OFFSET>000026</OFFSET>
<LENGTH>000008</LENGTH>
<TYPE>D</TYPE>
<FIELDTEXT>Valid-From Date</FIELDTEXT>
</item>
</FIELDS>
<OPTIONS />
</TABLES>
</RFC_READ_TABLE>
Add a repeater sourced on:
SAP_JCo_Interface_0.Response{/RFC_READ_TABLE/TABLES/DATA/item}
Link your repeater output to a tracer with this:
Repeater_0.Output{/item/WA}
What you will see in each tracer message is a single line of data with all the fields contents concatenated together. You can look up what each field in the string represents by the length of the field as returned in the Response segment of the RFC_READ_TABLE rfc. Then you can parse out the data you are interested in.
Give this a try and let me know how you succeeded.
By the way, I could not find the scenario you referred to. Can you post a link?
Regards,
Mike
Edited by: Michael Appleby on Jan 12, 2009 5:16 PM -
How to print extract value in dbms_output.put_line
CREATE OR REPLACE PROCEDURE pr_srch_data
AS
xml_data_val xmltype:=null;
vPropertyName clob;
vstr varchar2(1000);
operation varchar2(1000);
vQuery VARCHAR2(4000):=NULL;
vQry VARCHAR2(4000):=NULL;
vPartyid VARCHAR2(2000):=NULL;
vPerson varchar2(4000);
BEGIN
FOR I IN (SELECT EAPP_XML_DATA
FROM binary_xml
WHERE extractvalue(eapp_xml_data,'/OLifE/Party[@id="Party1"]/Person/LastName') Like 'Rajesh%'
LOOP
BEGIN
SELECT extractvalue(value(t),'/Relation/@RelatedObjectID')
INTO vPartyid
FROM TABLE (XMLSEQUENCE (EXTRACT (xml_data_val,'/OLifE/Relation'))) t
WHERE extractvalue(value(t),'/Relation/RelationRoleCode')='Owner'
AND existsnode(value(t),'/Relation/@RelatedObjectID')=1 ;
END;
SELECT extract(value(t),'/OLifE/Party[@id='''||vPartyid ||''']/Person')
INTO vPerson
FROM TABLE (XMLSEQUENCE (EXTRACT (I.EAPP_XML_DATA,'/OLifE')))t;
dbms_output.put_line('vPerson'||'--'||vPerson);
END LOOP;
END;
But when i am printing vPerson i am getting error. I need to print that extract value.Things to remember (that you should know by now)
Please remind us of which version of 11g you are using in this post and all future posts.
Look at the FAQ under your sign-in name to see how to use the tag to retain formatting of your code as you have seen our examples to you look like.
We can't see your screen or your data so how about the error message and some data from your table?
Please start using either XMLTable or XMLCast/XMLQuery as odie_63 as shown you.
What are you trying to do? -
Using XSLT to extract value of a XML node with namespace
I have a XML source code here.
<?xml version="1.0" encoding="utf-8" ?>
<rss version="2.0" xmlns:job="http://www.pageuppeople.com">
<channel>
<title>SMH Jobs</title>
<link>internalrecruitment.smhgroup.com.au/jobsrss.ashx?stp=di</link>
<description>A listing of jobs available here</description>
<item>
<title>eCommerce Optimisation Advisor</title>
<description>A new and exciting opportunity exists for an experienced eCommerce Advisor to join</description>
<job:location PUReferenceID="3711">Sydney - Inner Suburbs & CBD</job:location>
</item>
</channel>
</rss>
I want to use XSLT to extract value of a XML node with namespace <job:location>, and the returned value should be string 'Sydney - Inner Suburbs & CBD'. I tried a few XSL code below, but failed with error or nothing was returned.
<xsl:value-of select="job:location" disable-output-escaping="yes"/>
<xsl:value-of select="job/location" disable-output-escaping="yes"/>
<xsl:value-of select="job\location" disable-output-escaping="yes"/>
<xsl:value-of select="location" disable-output-escaping="yes"/>
This might be an easy question for you, but I would appreciate if anyone can help.Hi Suncorp IT Learner,
We need to tell the XSLT that some elements are in another namespace. Copy the xmls declarations for the prefixes you need to use. Then use the xsl format as:
<xsl: value-of select=”job:location/@PUReferenceID”/>
In following issue, Chriztian has a good explanation:
http://our.umbraco.org/forum/developers/xslt/33353-XSLT-reading-XML-attribute-value
Thanks,
Qiao Wei
TechNet Community Support -
Receiver Determination, condition to select receiver doesn't extract values
Dear all!
I have SAP PI 7.1
I am facing problem in Receiver Determination while using Condition to select receiver based on the values in the payload.
I need, if Identificador = 1 then receiver BC_1 and if Identificador = 2 then the receiver BC_2
My payload has the value:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:p1="http://pruebas.endesa.es/AME4S_2">
<soap:Body>
<p1:MT_WS_SENDER_Q>
<IDENTIFICADOR>1</IDENTIFICADOR>
<OBJECT_ID>7600000009</OBJECT_ID>
</p1:MT_WS_SENDER_Q>
</soap:Body>
</soap:Envelope>
But, the trace shows following:
<Trace level="2" type="T">......extracting (new) for Extractor: XP /p1:MT_WS_SENDER_Q/IDENTIFICADOR </Trace>
<Trace level="2" type="T">......extracting values found: 0 </Trace>
I tried with double quotes, simple quotes, without quotes...
I tried too with a Receiver Rule (with context) and local rule with xpath....
Can someone please advise?
Thanks in advanced!!Hello,
/p1:MT_WS_SENDER_Q/IDENTIFICADOR = 1
Can you try //p1:MT_WS_SENDER_Q/IDENTIFICADOR = 1 ? I'm sure I read it somewhere here in SDN regarding the xPath difference for stateless and stateless XI 3.0 compatible version is an additional /. It's worth to try
Hope this helps,
Mark -
And operation in extract value
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
PL/SQL Release 11.1.0.6.0 - Production
CORE 11.1.0.6.0 Production
TNS for Solaris: Version 11.1.0.6.0 - Production
NLSRTL Version 11.1.0.6.0 - Production
This is my input xml
- <OLifE>
- <SourceInfo>
<SourceInfoName>Client Profile</SourceInfoName>
</SourceInfo>
- <Activity id="Act1" PartyID="Party1">
<ActivityStatus tc="2">In Progress</ActivityStatus>
<UserCode>123456</UserCode>
<Opened>2010-08-17</Opened>
<ActivityCode>CP10001</ActivityCode>
- <Attachment>
<Description>LastScreenName</Description>
<AttachmentData>CP Create</AttachmentData>
<AttachmentType tc="2">OLI_ATTACH_COMMENT</AttachmentType>
<AttachmentLocation tc="1">OLI_INLINE</AttachmentLocation>
</Attachment>
- <OLifEExtension VendorCode="05" ExtensionCode="Activity">
- <ActivityExtension>
<SubActivityCode>CP20001</SubActivityCode>
</ActivityExtension>
</OLifEExtension>
</Activity>
- <Relation OriginatingObjectID="Holding1" id="Relation4" RelatedObjectID="Party1">
<OriginatingObjectType tc="4">Holding</OriginatingObjectType>
<RelatedObjectType tc="6">Party</RelatedObjectType>
<RelationRoleCode tc="8">Owner</RelationRoleCode>
</Relation>
Here xml_data_val is the input xml.
BEGIN
SELECT extractvalue(value(t),'OLifE/Activity[@PartyID=/OLifE/Relation[RelationRoleCode/@tc=8]/@RelatedObjectID]/ActivityStatus/@tc'),
extractvalue(value(t),'/OLifE/Activity[@PartyID=/OLifE/Relation[RelationRoleCode/@tc=8]/@RelatedObjectID]/Opened'),
extractvalue(value(t),'/OLifE/Activity[@PartyID=/OLifE/Relation[RelationRoleCode/@tc=8]/@RelatedObjectID AND /OLifE/Activity/ActivityCode=CP10001]/UserCode'),
extract(value(t),'/OLifE'),
extractvalue(value(t),'/OLifE/Relation[RelationRoleCode/@tc=8]/@RelatedObjectID')
INTO nActstat,
vDate,
vUsercreated,
xml_data_val,
vPartyid
FROM TABLE
XMLSEQUENCE
EXTRACT (xml_data_val,'/TXLife/TXLifeRequest/OLifE')
)t;
dDate:=TO_DATE(vDate,'YYYY-MM-DD');
Exception
WHEN OTHERS THEN
ncode:=5;
nErrcode:=2003;
vStatus:='FAILURE';
vStatusinfo:='Required Element Missing';
Raise_application_error(-20201,'Required information not available');
END;
I am facing problem here is i am not able to retrive UserCode value.
Edited by: user13444979 on Dec 13, 2010 8:09 AMIs this what you are looking for ?
SQL> column ACTIVITY format A80
SQL> --
SQL> set lines 256 long 10000
SQL> --
SQL> VAR XMLTEXT CLOB
SQL> --
SQL> begin
2 :XMLTEXT :=
3 '<TXLife Version="2.15.00" xmlns="http://ACORD.org/Standards/Life/2">
4 <UserAuthRequest>
5 <UserLoginName>CPUser</UserLoginName>
6 </UserAuthRequest>
7 <TXLifeRequest>
8 <TransRefGUID>10bc80e7d60e59b0:a134d0:10d7c4674ad:-7ffc</TransRefGUID>
9 <TransType tc="301">OLI_TRANS_SRCPAR</TransType>
10 <TransExeDate>2010-08-24</TransExeDate>
11 <TransExeTime>12:01:01</TransExeTime>
12 <InquiryLevel tc="3">OLI_INQUIRY_OBJRELOBJ</InquiryLevel>
13 <InquiryView>
14 <InquiryViewCode>CS-301-002</InquiryViewCode>
15 </InquiryView>
16 <MaxRecords>20</MaxRecords>
17 <CriteriaExpression>
18 <CriteriaOperator tc="2">AND</CriteriaOperator>
19 <Criteria>
20 <ObjectType tc="6">Party</ObjectType>
21 <PropertyName>LastName</PropertyName>
22 <PropertyValue>AXA</PropertyValue>
23 <Operation tc="1">OLI_OP_EQUAL</Operation>
24 </Criteria>
25 <Criteria>
26 <ObjectType tc="6">Party</ObjectType>
27 <PropertyName>GovtID</PropertyName>
28 <PropertyValue>123456789</PropertyValue>
29 <Operation tc="1">OLI_OP_EQUAL</Operation>
30 </Criteria>
31 <Criteria>
32 <ObjectType tc="6">Party</ObjectType>
33 <PropertyName>GovtIDTc</PropertyName>
34 <PropertyValue>1</PropertyValue>
35 <Operation tc="1">OLI_OP_EQUAL</Operation>
36 </Criteria>
37 <Criteria>
38 <ObjectType tc="6">Party</ObjectType>
39 <PropertyName>ResidenceState</PropertyName>
40 <PropertyValue>AL</PropertyValue>
41 <Operation tc="1">OLI_OP_EQUAL</Operation>
42 </Criteria>
43 <CriteriaExpression>
44 <CriteriaOperator tc="2">AND</CriteriaOperator>
45 <Criteria>
46 <ObjectType tc="7">Activity</ObjectType>
47 <PropertyName>ActivityTypeCode</PropertyName>
48 <PropertyValue>CIH10028</PropertyValue>
49 <Operation tc="1">OLI_OP_EQUAL</Operation>
50 </Criteria>
51 <Criteria>
52 <ObjectType tc="7">Activity</ObjectType>
53 <PropertyName>ActivityDescription</PropertyName>
54 <PropertyValue>CIH50167</PropertyValue>
55 <Operation tc="1">OLI_OP_EQUAL</Operation>
56 </Criteria>
57 <Criteria>
58 <ObjectType tc="7">Activity</ObjectType>
59 <PropertyName>UserCode</PropertyName>
60 <PropertyValue>123456</PropertyValue>
61 <Operation tc="1">OLI_OP_EQUAL</Operation>
62 </Criteria>
63 </CriteriaExpression>
64 <CriteriaExpression>
65 <CriteriaOperator tc="2">AND</CriteriaOperator>
66 <Criteria>
67 <ObjectType tc="7">Activity</ObjectType>
68 <PropertyName>ActivityTypeCode</PropertyName>
69 <PropertyValue>CIH10028</PropertyValue>
70 <Operation tc="1">OLI_OP_EQUAL</Operation>
71 </Criteria>
72 <Criteria>
73 <ObjectType tc="7">Activity</ObjectType>
74 <PropertyName>ActivityStatus</PropertyName>
75 <PropertyValue>4</PropertyValue>
76 <Operation tc="1">OLI_OP_EQUAL</Operation>
77 </Criteria>
78 </CriteriaExpression>
79 <CriteriaExpression>
80 <CriteriaOperator tc="2">AND</CriteriaOperator>
81 <Criteria>
82 <ObjectType tc="7">Activity</ObjectType>
83 <PropertyName>ActivityTypeCode</PropertyName>
84 <PropertyValue>CIH10028</PropertyValue>
85 <Operation tc="1">OLI_OP_EQUAL</Operation>
86 </Criteria>
87 <Criteria>
88 <ObjectType tc="7">Activity</ObjectType>
89 <PropertyName>Closed</PropertyName>
90 <PropertyValue>2010-08-16</PropertyValue>
91 <Operation tc="4">OLI_OP_GREATERTHAN</Operation>
92 </Criteria>
93 <Criteria>
94 <ObjectType tc="7">Activity</ObjectType>
95 <PropertyName>Closed</PropertyName>
96 <PropertyValue>2010-08-24</PropertyValue>
97 <Operation tc="3">OLI_OP_LESSTHAN</Operation>
98 </Criteria>
99 </CriteriaExpression>
100 </CriteriaExpression>
101 <OLifE>
102 <SourceInfo>
103 <SourceInfoName>Client Profile</SourceInfoName>
104 </SourceInfo>
105 <Activity id="Act1" PartyID="Party1">
106 <ActivityStatus tc="2">In Progress</ActivityStatus>
107 <UserCode>123456</UserCode>
108 <Opened>2010-08-17</Opened>
109 <ActivityCode>CP10001</ActivityCode>
110 <Attachment>
111 <Description>LastScreenName</Description>
112 <AttachmentData>CP Create</AttachmentData>
113 <AttachmentType tc="2">OLI_ATTACH_COMMENT</AttachmentType>
114 <AttachmentLocation tc="1">OLI_INLINE</AttachmentLocation>
115 </Attachment>
116 <OLifEExtension VendorCode="05" ExtensionCode="Activity">
117 <ActivityExtension>
118 <SubActivityCode>CP20001</SubActivityCode>
119 </ActivityExtension>
120 </OLifEExtension>
121 </Activity>
122 <Relation OriginatingObjectID="Holding1" id="Relation4" RelatedObjectID="Party1">
123 <OriginatingObjectType tc="4">Holding</OriginatingObjectType>
124 <RelatedObjectType tc="6">Party</RelatedObjectType>
125 <RelationRoleCode tc="8">Owner</RelationRoleCode>
126 </Relation>
127 </OLifE>
128 </TXLifeRequest>
129 </TXLife>';
130 end;
131 /
PL/SQL procedure successfully completed.
SQL> column XML FORMAT A128
SQL> set heading on lines 256 pages 20 long 10000
SQL> --
SQL> with TXLIFE_TABLE
2 as
3 (
4 select XMLTYPE(:XMLTEXT) as OBJECT_VALUE
5 from DUAL
6 )
7 select NACTSTAT, VPARTYID, VDATE, VUSERCREATED,
8 XMLSERIALIZE(DOCUMENT ACTIVITY AS CLOB INDENT SIZE=2) ACTIVITY
9 from TXLIFE_TABLE,
10 XMLTable
11 (
12 xmlNamespaces
13 (
14 default 'http://ACORD.org/Standards/Life/2'
15 ),
16 'for $OLifE in $TX/TXLife/TXLifeRequest/OLifE
17 for $RELATION in $OLifE/Relation[RelationRoleCode/@tc=8], $ACTIVITY in $OLifE/Activity[@PartyID=$RELATION/@RelatedObjectID and ActivityCode="CP10001"]
18 return
19 <Result>
20 {
21 <ACTSTAT>{fn:data($ACTIVITY/ActivityStatus/@tc)}</ACTSTAT>,
22 <PARTYID>{fn:data($RELATION/@RelatedObjectID)}</PARTYID>,
23 $ACTIVITY/Opened,
24 $ACTIVITY/UserCode,
25 $ACTIVITY
26 }
27 </Result>'
28 passing OBJECT_VALUE as "TX"
29 columns
30 NACTSTAT NUMBER(2) PATH 'ACTSTAT',
31 VPARTYID VARCHAR2(10) PATH 'PARTYID',
32 VDATE DATE PATH 'Opened',
33 VUSERCREATED VARCHAR2(20) PATH 'UserCode',
34 ACTIVITY XMLTYPE PATH 'Activity'
35 ) t
36 /
NACTSTAT VPARTYID VDATE VUSERCREATED ACTIVITY
2 Party1 17-AUG-10 123456 <Activity xmlns="http://ACORD.org/Standards/Life/2" id="Act1" PartyID="Party1">
<ActivityStatus tc="2">In Progress</ActivityStatus>
<UserCode>123456</UserCode>
<Opened>2010-08-17</Opened>
<ActivityCode>CP10001</ActivityCode>
<Attachment>
<Description>LastScreenName</Description>
<AttachmentData>CP Create</AttachmentData>
<AttachmentType tc="2">OLI_ATTACH_COMMENT</AttachmentType>
<AttachmentLocation tc="1">OLI_INLINE</AttachmentLocation>
</Attachment>
<OLifEExtension VendorCode="05" ExtensionCode="Activity">
<ActivityExtension>
<SubActivityCode>CP20001</SubActivityCode>
</ActivityExtension>
</OLifEExtension>
</Activity>
NACTSTAT VPARTYID VDATE VUSERCREATED ACTIVITY
SQL> -
How can I extract value based on the specific tag?
Hello,
I have a sample xml file:
<?xml version="1.0" encoding="UTF-8"?>
<listings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://local.google.com/local_feed.xsd">
<language>en</language>
<datum>WGS84</datum>
<listing>
<id>242238</id>
<name>Baskin-Robbins</name>
<date month="5" day="13" year="2010" />
<content>
<text type="menu">
<link>http://www.allmenus.com/ca/san-fernando-valley/242238-baskin-robbins/menu/</link>
<title>Baskin-Robbins</title>
<author>Allmenus.com</author>
<body>View this menu online at Allmenus.com</body>
</text>
<attributes>
<link>http://www.allmenus.com/ca/san-fernando-valley/242238-baskin-robbins/menu/</link>
<title>Baskin-Robbins</title>
<attr name="Average Entree">$41.95</attr>
<attr name="Cuisine">Ice Cream</attr>
<attr name="Cuisine">American</attr>
<attr name="Payment accepted">Cash</attr>
<attr name="Feature">Cheap Eats</attr>
<attr name="Feature">Kid Friendly</attr>
<attr name="Feature">Fast Food</attr>
<date month="5" day="13" year="2010" />
</attributes>
</content>
</listing>
<listing>
<id>243810</id>
<name>Villa Maria Pizzeria & Restaurant</name>
<date month="5" day="13" year="2010" />
<content>
<text type="menu">
<link>http://www.allmenus.com/ny/nassau-county/243810-villa-maria-pizzeria--restaurant/menu/</link>
<title>Villa Maria Pizzeria & Restaurant</title>
<author>Allmenus.com</author>
<body>View this menu online at Allmenus.com</body>
</text>
<attributes>
<link>http://www.allmenus.com/ny/nassau-county/243810-villa-maria-pizzeria--restaurant/menu/</link>
<title>Villa Maria Pizzeria & Restaurant</title>
<attr name="Hours">Sun 12pm-9pm; Mon 11am-10pm; Tue 11am-10pm; Wed 11am-10pm; Thu 11am-10pm; Fri 11am-10pm; Sat 11am-10pm</attr>
<attr name="Last Delivery">Sun 9pm; Mon 10pm; Tue 10pm; Wed 10pm; Thu 10pm; Fri 10pm; Sat 10pm</attr>
<attr name="Order Online">http://orders.allmenus.com/restaurant.asp?restid=5999&campusid=835</attr>
<attr name="Average Entree">$7.95</attr>
<attr name="Minimum for Delivery">$25.00</attr>
<attr name="Cuisine">Pizza</attr>
<attr name="Cuisine">Sandwiches</attr>
<attr name="Cuisine">Calzones</attr>
<attr name="Payment accepted">Cash</attr>
<attr name="Payment accepted">Visa</attr>
<attr name="Payment accepted">Mastercard</attr>
<attr name="Payment accepted">Discover</attr>
<attr name="Payment accepted">Amex</attr>
<attr name="Nearby School">Hofstra University</attr>
<attr name="Nearby School">SUNY-Farmingdale</attr>
<attr name="Feature">Free Delivery</attr>
<attr name="Feature">Open 7 Days</attr>
<attr name="Online Order">Yes</attr>
<date month="5" day="13" year="2010" />
</attributes>
</content>
</listing>
</listings>
As you can see, some row has <attr name="Order Online"> and some don't. I want to extract value of this attribute. It can be null for rows that don't have this attribute. How can I do it with extractvalue function? THANKS A LOT!I figured it out that I should do the following:
select extractvalue(value(x),'/listing/content/attributes/attr[@name="Order Online"]')
from load_xml_file t, table(xmlsequence(extract(t.xml,'/listings/listing'))) x
Thanks! -
How to use 'Extract Values' transformation?
Hi,
I am new to EDQ. I have the following requirement - source system sends me partyname+address details. I need to check in the oracle database and if there is a match then send back the ID along with the input details. I am using Lookup check audit process to check if the data is present in the database. If the data is present then I need to send back the ID. To extract the ID I am using 'Extract Values' transformation. I am not able define the Reference Data for this . Can provide a example how to use the same.
Thanks
PrabhaJust use Lookup and Return.
Though it sounds like you really should be using a match process. -
Hi,
I am trying to extract value of after each period.
I the table data is stored in this fashion 172.168.15.10 which is a IP address,
My Requirement is, I need first value in a query with must return 172
If I need value after second period it must return 168
Please suggest me how to write a sql query for the above requirement and using oracle 11i Enterprise edition as the database.
Thanks
SudhirThis way
with data as
select '172.168.15.10' col from dual
mod_data as
select col || '.' col from data
select substr(col, 1, instr(col, '.') - 1) col1,
substr(col, instr(col, '.', 1, 1) + 1, instr(col, '.', 1, 2) - instr(col, '.', 1, 1) - 1) col2,
substr(col, instr(col, '.', 1, 2) + 1, instr(col, '.', 1, 3) - instr(col, '.', 1, 2) - 1) col3,
substr(col, instr(col, '.', 1, 3) + 1, instr(col, '.', 1, 4) - instr(col, '.', 1, 3) - 1) col4
from mod_data;
COL1 COL2 COL3 COL4
172 168 15 10 -
Problem extracting value from reference
Hi all,
I have a main VI where the user specifies a range for acquiring data. These values are then passed to a subVI which iterates a loop an according number of times. I have created a reference in the subVI which passes the position of the data acquisition in the range specified as I want to provide a progress bar which would be calculated as (max value - current value)/(maxvalue - minvalue).
I created an indicator to show the current value on the main VI which is related to the reference I created and when I run the main VI I can see this value changing correctly. The problem is that I cannot find a way to wire this value into the formula above. I tried changing the indicator to a control, but the value is not passed.
I have attached my code along with the subVIs to illustrate the problem. Current Frequency A increments correctly on the screen whereas Current Frequency B stays constant. I have also tried using local variables, property nodes and an OpenVIReference Node but none of these solve the problem.
I'm sure this must be possible so if somebody could tell me the correct way to go about it then that would be much appreciated :-)
Many thanks,
Ian
Attachments:
FRA SubVI.vi 71 KB
extract value from reference.vi 52 KB
DATA FROM RIG v2.vi 553 KBNo worries - I managed to solve my own problem.
I realised if I did the calculation and created the progress bar on the subVI and made the reference straight to that then it wouldn't required the need to bring a wire from the reference.
Still, I'd be intrigued to know if I could've done it the other way tho...
Ian -
In TXN CO03, extract value for field "To Confirm" under tab "Qty/Activity"
Hi,
Can anyone help to extract value for field "To Confirm" under tab "QTY/ACTIVITIES" in tansaction CO03 at operatin level. There are three Activiti (CC-Set-up,CC-Labor Time & CC-Var-OH) under table control Activities. I need value of the field "To Confirm" for CC-Labor Time.
From where I can fetch this value,
1. Is this field available in some table?
2. Is there any FM with which the same can be extracted.
3. Any other method?
Regards,
Bibhuti.
Edited by: bibhuti kumar on Feb 20, 2008 6:16 AMHi,
pls use below table's and get detals you want
AFKO - Order header details
AFVC - Order operation details
AFVV - Order operation value/date's/qty details
the relation is below
Step1: AFKO; AUFNR-->AFKO-AUFPL
Step2: AFVC; AFKO-AUFPL = AFVC-AUFPL
take filed to APLZL,VORNR
Step3: AFVV;AFKO-AUFPL=AFVV-AUFPL, AFVC-AUFPL = AFVV-AUFPL
take filed to MGVRG,LMNGA,XMNGA,VGW02
Step4: (MGVRG - (LMNGA+XMNGA)) * VGW02
hope this will solve your problem
Regards,
Sankaran -
Extract values with Regular Expression
How to extract values into [ ] using regular expression.
With data As
Select 'AAAAAA[10] AAA: 19C' Txt From Dual Union all
Select 'XX[450]-10A' Txt From Dual Union all
Select '[5]AVC19C' Txt From Dual Union all
Select 'FVD[120]D2AC' Txt From Dual
)I hope this return
10
450
5
120Thanks in advanceduser11118871 wrote:
Thanks for all.
Hi BluShadow, can you explain what this is doing!?
ThanksSure.
Search for ----------------| /------- Replace the found pattern in the search string with backreference 1
/------------\ /\ (the first thing backreferenced in the search string)
regexp_replace(txt, '^.*\[(.*)\].*$','\1')
|\/\/\--/\/\/|
| \ \ / \ \|
| | | | | |\- End of string
| | | | | |
| | | | | \- Any number of characters
| | | | |
| | | | \- Right square bracket (escaped)
| | | |
| | | \- any characters (backreferenced by round brackets)
| | |
| | \- Left square bracket (escaped)
| |
| \- Any number of characters
|
\- Start of stringEdited by: BluShadow on Jun 29, 2009 2:19 PM -
Hi
I have to extract value for Domain Name attribute, Please give me the query to do it.
Thanks lot in advance
Murthy
<?xml version="1.0" encoding="ISO-8859-1"?>
<?Siebel-Property-Set EscapeNames="false"?>
<SiebelMessage MessageId="1-Y4BH" LineItemCount="" IntObjectName="MH Order Item Integration" MessageType="Integration Object" IntObjectFormat="Siebel Hierarchical">
<ListOfMhOrderItemIntegration>
<OrderItem>
<AccountExecID/>
<ActionCode>Add</ActionCode>
<AltRepID>20</AltRepID>
<AddressRowId>1-4XL4-115</AddressRowId>
<AttentionTo/>
<CancelCode/>
<CancelDate/>
<City>Houston</City>
<ContractDate/>
<Country>USA</Country>
<CreatedBy>SADMIN</CreatedBy>
<CreatedDateTime>10/19/2005 09:40:50</CreatedDateTime>
<CreditCardExpDate/>
<CreditCardNumber/>
<CreditCardType/>
<CustomerNumber>5020047500</CustomerNumber>
<EditionYear>2006</EditionYear>
<GrossAmount>590</GrossAmount>
<HoldBilling/>
<HoldShipping/>
<InceptionCode>N</InceptionCode>
<LastUpdatedDateTime>10/19/2005 12:41:12</LastUpdatedDateTime>
<LastYearTrackingNumber/>
<LineAmount>590</LineAmount>
<LineItemRowID>1-1DWIEK</LineItemRowID>
<LineItemStatus>New</LineItemStatus>
<ListingID>3803930</ListingID>
<MigrationChildCode/>
<MealeysSubId/>
<MealeysPwd/>
<MigrationType/>
<OrderCanvassDate>10/19/2005 00:00:00</OrderCanvassDate>
<OrderHeaderId>1-1DWHZU</OrderHeaderId>
<OrderLastUpdatedBy>UMATTJA</OrderLastUpdatedBy>
<OrderNumber>835905</OrderNumber>
<OrderTaker>20</OrderTaker>
<OrgID>2486393</OrgID>
<POBox/>
<PrimaryRepID>35</PrimaryRepID>
<Producer>SIEBEL</Producer>
<ProductCode>01807</ProductCode>
<ProductContent>51</ProductContent>
<ProductName>LHP Plus</ProductName>
<PurchaseOrderNumber/>
<Quantity>1</Quantity>
<ReferenceNumber/>
<ReinstatedDate/>
<ReturnMessage>This URL already used by another organization.</ReturnMessage>
<Revision>0</Revision>
<RollupCount/>
<ServiceAccountName>McEwing, David</ServiceAccountName>
<ShippingCharges/>
<SiebelAssetIntegrationId>1-1DWIEK</SiebelAssetIntegrationId>
<SiebelID>2683171</SiebelID>
<SiebelIntegrationId>1-1DWIEK</SiebelIntegrationId>
<SiebelLineNumber>5</SiebelLineNumber>
<SiebelLineNumber2/>
<SignedBy/>
<State>TX</State>
<StateCode>48</StateCode>
<StreetAddress1>3200 Southwest Freeway, 2355 Phoenix Tower</StreetAddress1>
<Suite/>
<TotalDiscountAmount>0</TotalDiscountAmount>
<TrackingNumber>1-1DXOFH</TrackingNumber>
<UnitPrice>590</UnitPrice>
<ZipCode>77027</ZipCode>
<TaxableFlg/>
<SolRept/>
<ListOfAttribute>
<Attribute>
<AttrProductCode>1812</AttrProductCode>
<TrackingNumber>1-1DXOFS</TrackingNumber>
<Name>Number of Attorneys</Name>
<SiebelAttrName>100Number of Attorneys LHP Plus|1812</SiebelAttrName>
<Value>1</Value>
</Attribute>
<Attribute>
<AttrProductCode/>
<TrackingNumber>1-1DXOFV</TrackingNumber>
<Name>Domain Name</Name>
<SiebelAttrName>103 Domain Name</SiebelAttrName>
<Value>davidmcewinglaw.com</Value>
</Attribute>
<Attribute>
<AttrProductCode/>
<TrackingNumber>1-1DXOFR</TrackingNumber>
<Name>Tag Line</Name>
<SiebelAttrName>200 Tag Line</SiebelAttrName>
<Value>Intellectual Property, Divisional Applications, Trademark, Patent, Copyright, Internet Law</Value>
</Attribute>
<Attribute>
<AttrProductCode/>
<TrackingNumber>1-1DXOFO</TrackingNumber>
<Name>Template</Name>
<SiebelAttrName>201Template Selection</SiebelAttrName>
<Value>None</Value>
</Attribute>
<Attribute>
<AttrProductCode/>
<TrackingNumber>1-1DXOFN</TrackingNumber>
<Name>Registration Type</Name>
<SiebelAttrName>202Registration Type</SiebelAttrName>
<Value>NEW</Value>
</Attribute>
<Attribute>
<AttrProductCode/>
<TrackingNumber>1-1DXOFW</TrackingNumber>
<Name>Contact First Name</Name>
<SiebelAttrName>250Contact First Name</SiebelAttrName>
<Value>David</Value>
</Attribute>
<Attribute>
<AttrProductCode/>
<TrackingNumber>1-1DXOFU</TrackingNumber>
<Name>Contact Last Name</Name>
<SiebelAttrName>251Contact Last Name</SiebelAttrName>
<Value>McEwing</Value>
</Attribute>
<Attribute>
<AttrProductCode/>
<TrackingNumber>1-1DXOFM</TrackingNumber>
<Name>Contact eMail</Name>
<SiebelAttrName>252Contact eMail</SiebelAttrName>
<Value>[email protected]</Value>
</Attribute>
<Attribute>
<AttrProductCode/>
<TrackingNumber>1-1DXOFQ</TrackingNumber>
<Name>Contact Fax</Name>
<SiebelAttrName>2533Contact Fax</SiebelAttrName>
<Value>713-514-9840</Value>
</Attribute>
<Attribute>
<AttrProductCode/>
<TrackingNumber>1-1DXOFP</TrackingNumber>
<Name>Contact Phone</Name>
<SiebelAttrName>253Contact Phone</SiebelAttrName>
<Value>713-514-0137</Value>
</Attribute>
<Attribute>
<AttrProductCode/>
<TrackingNumber>1-1DXOFT</TrackingNumber>
<Name>Site Name</Name>
<SiebelAttrName>256URL</SiebelAttrName>
<Value/>
</Attribute>
<Attribute>
<AttrProductCode/>
<TrackingNumber>1-1DXOFL</TrackingNumber>
<Name>Future unique heads</Name>
<SiebelAttrName>Future unique heads</SiebelAttrName>
<Value/>
</Attribute>
</ListOfAttribute>
</OrderItem>
</ListOfMhOrderItemIntegration>
</SiebelMessage>Once the problem is clearly stated the answer is simple...
SQL> set serveroutput on
SQL> declare
2 myXML XMLType := xmlType(
3 '<?xml version="1.0" encoding="ISO-8859-1"?>
4 <?Siebel-Property-Set EscapeNames="false"?>
5 <SiebelMessage MessageId="1-Y4BH" LineItemCount="" IntObjectName="MH Order Item Integration" MessageType="Integratio
Format="Siebel Hierarchical">
6 <ListOfMhOrderItemIntegration>
7 <OrderItem>
8 <AccountExecID/>
9 <ActionCode>Add</ActionCode>
10 <AltRepID>20</AltRepID>
11 <AddressRowId>1-4XL4-115</AddressRowId>
12 <AttentionTo/>
13 <CancelCode/>
14 <CancelDate/>
15 <City>Houston</City>
16 <ContractDate/>
17 <Country>USA</Country>
18 <CreatedBy>SADMIN</CreatedBy>
19 <CreatedDateTime>10/19/2005 09:40:50</CreatedDateTime>
20 <CreditCardExpDate/>
21 <CreditCardNumber/>
22 <CreditCardType/>
23 <CustomerNumber>5020047500</CustomerNumber>
24 <EditionYear>2006</EditionYear>
25 <GrossAmount>590</GrossAmount>
26 <HoldBilling/>
27 <HoldShipping/>
28 <InceptionCode>N</InceptionCode>
29 <LastUpdatedDateTime>10/19/2005 12:41:12</LastUpdatedDateTime>
30 <LastYearTrackingNumber/>
31 <LineAmount>590</LineAmount>
32 <LineItemRowID>1-1DWIEK</LineItemRowID>
33 <LineItemStatus>New</LineItemStatus>
34 <ListingID>3803930</ListingID>
35 <MigrationChildCode/>
36 <MealeysSubId/>
37 <MealeysPwd/>
38 <MigrationType/>
39 <OrderCanvassDate>10/19/2005 00:00:00</OrderCanvassDate>
40 <OrderHeaderId>1-1DWHZU</OrderHeaderId>
41 <OrderLastUpdatedBy>UMATTJA</OrderLastUpdatedBy>
42 <OrderNumber>835905</OrderNumber>
43 <OrderTaker>20</OrderTaker>
44 <OrgID>2486393</OrgID>
45 <POBox/>
46 <PrimaryRepID>35</PrimaryRepID>
47 <Producer>SIEBEL</Producer>
48 <ProductCode>01807</ProductCode>
49 <ProductContent>51</ProductContent>
50 <ProductName>LHP Plus</ProductName>
51 <PurchaseOrderNumber/>
52 <Quantity>1</Quantity>
53 <ReferenceNumber/>
54 <ReinstatedDate/>
55 <ReturnMessage>This URL already used by another organization.</ReturnMessage>
56 <Revision>0</Revision>
57 <RollupCount/>
58 <ServiceAccountName>McEwing, David</ServiceAccountName>
59 <ShippingCharges/>
60 <SiebelAssetIntegrationId>1-1DWIEK</SiebelAssetIntegrationId>
61 <SiebelID>2683171</SiebelID>
62 <SiebelIntegrationId>1-1DWIEK</SiebelIntegrationId>
63 <SiebelLineNumber>5</SiebelLineNumber>
64 <SiebelLineNumber2/>
65 <SignedBy/>
66 <State>TX</State>
67 <StateCode>48</StateCode>
68 <StreetAddress1>3200 Southwest Freeway, 2355 Phoenix Tower</StreetAddress1>
69 <Suite/>
70 <TotalDiscountAmount>0</TotalDiscountAmount>
71 <TrackingNumber>1-1DXOFH</TrackingNumber>
72 <UnitPrice>590</UnitPrice>
73 <ZipCode>77027</ZipCode>
74 <TaxableFlg/>
75 <SolRept/>
76 <ListOfAttribute>
77 <Attribute>
78 <AttrProductCode>1812</AttrProductCode>
79 <TrackingNumber>1-1DXOFS</TrackingNumber>
80 <Name>Number of Attorneys</Name>
81 <SiebelAttrName>100Number of Attorneys LHP Plus|1812</SiebelAttrName>
82 <Value>1</Value>
83 </Attribute>
84 <Attribute>
85 <AttrProductCode/>
86 <TrackingNumber>1-1DXOFV</TrackingNumber>
87 <Name>Domain Name</Name>
88 <SiebelAttrName>103 Domain Name</SiebelAttrName>
89 <Value>davidmcewinglaw.com</Value>
90 </Attribute>
91 <Attribute>
92 <AttrProductCode/>
93 <TrackingNumber>1-1DXOFR</TrackingNumber>
94 <Name>Tag Line</Name>
95 <SiebelAttrName>200 Tag Line</SiebelAttrName>
96 <Value>Intellectual Property, Divisional Applications, Trademark, Patent, Copyrig
alue>
97 </Attribute>
98 <Attribute>
99 <AttrProductCode/>
100 <TrackingNumber>1-1DXOFO</TrackingNumber>
101 <Name>Template</Name>
102 <SiebelAttrName>201Template Selection</SiebelAttrName>
103 <Value>None</Value>
104 </Attribute>
105 <Attribute>
106 <AttrProductCode/>
107 <TrackingNumber>1-1DXOFN</TrackingNumber>
108 <Name>Registration Type</Name>
109 <SiebelAttrName>202Registration Type</SiebelAttrName>
110 <Value>NEW</Value>
111 </Attribute>
112 <Attribute>
113 <AttrProductCode/>
114 <TrackingNumber>1-1DXOFW</TrackingNumber>
115 <Name>Contact First Name</Name>
116 <SiebelAttrName>250Contact First Name</SiebelAttrName>
117 <Value>David</Value>
118 </Attribute>
119 <Attribute>
120 <AttrProductCode/>
121 <TrackingNumber>1-1DXOFU</TrackingNumber>
122 <Name>Contact Last Name</Name>
123 <SiebelAttrName>251Contact Last Name</SiebelAttrName>
124 <Value>McEwing</Value>
125 </Attribute>
126 <Attribute>
127 <AttrProductCode/>
128 <TrackingNumber>1-1DXOFM</TrackingNumber>
129 <Name>Contact eMail</Name>
130 <SiebelAttrName>252Contact eMail</SiebelAttrName>
131 <Value>[email protected]</Value>
132 </Attribute>
133 <Attribute>
134 <AttrProductCode/>
135 <TrackingNumber>1-1DXOFQ</TrackingNumber>
136 <Name>Contact Fax</Name>
137 <SiebelAttrName>2533Contact Fax</SiebelAttrName>
138 <Value>713-514-9840</Value>
139 </Attribute>
140 <Attribute>
141 <AttrProductCode/>
142 <TrackingNumber>1-1DXOFP</TrackingNumber>
143 <Name>Contact Phone</Name>
144 <SiebelAttrName>253Contact Phone</SiebelAttrName>
145 <Value>713-514-0137</Value>
146 </Attribute>
147 <Attribute>
148 <AttrProductCode/>
149 <TrackingNumber>1-1DXOFT</TrackingNumber>
150 <Name>Site Name</Name>
151 <SiebelAttrName>256URL</SiebelAttrName>
152 <Value/>
153 </Attribute>
154 <Attribute>
155 <AttrProductCode/>
156 <TrackingNumber>1-1DXOFL</TrackingNumber>
157 <Name>Future unique heads</Name>
158 <SiebelAttrName>Future unique heads</SiebelAttrName>
159 <Value/>
160 </Attribute>
161 </ListOfAttribute>
162 </OrderItem>
163 </ListOfMhOrderItemIntegration>
164 </SiebelMessage>'
165 );
166 result varchar2(64);
167 begin
168 select extractValue(value(attr),'/Attribute/Value')
169 into result
170 from table(xmlsequence(extract(myXML,'/SiebelMessage/ListOfMhOrderItemIntegration/OrderItem/ListOfAttribute/Att
171 where existsNode(value(attr),'/Attribute[Name="Domain Name"]') = 1;
172 dbms_output.put_line('Result = ' || result);
173 end;
174 /
Result = davidmcewinglaw.com
PL/SQL procedure successfully completed.
SQL>This assumes that there is only one Attribute element with a Name node whose value is "Domain Name". If there was more than one such node you would have to use a cursor and process the results in loop. -
Extract values from a long text
Hi, I need help in extracting value from a long text
Sample data:
A_BOARD_MEETING_600
I need to extract MEETING from the text.
I tried to use CHARINDEX and SUBSTRING but it's not returning the text I wanted. I hope you can help me.
select SUBSTRING(ID, CHARINDEX('_', ID,1+CHARINDEX('_', ID))+1, CHARINDEX('_', ID, 1+CHARINDEX('_', ID, 1+CHARINDEX('_', ID,1)))-1 ) from table
Using the query above it's returning MEETING_600.Hi, thanks! But would like to ask how can this be converted where it can get the column ID in a table, I'm still learning SQL.
Select Parsename(Replace(YOURCOLUMNNAME,'_','.'),2)From your tablename -
Need help in extracting value from an xml tag.
Hi ALL,
Good Morning to all, i have problem in fetching a value from a xml tag. I have created a xml schema based on the schema i have created a xmltype table and inserted a value to the table. When i am trying to fetch a value from a particular tag i am unable to do so.. Kindly help me to solve this. Here by i am posting all the workings i have done...
I am using the following client:
SQL*Plus: Release 10.2.0.1.0 - Production on Mon Jan 31 11:44:59 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
////////////////////////////////// XML Schema ///////////////////////
begin
dbms_xmlschema.registerSchema(
'http://www.oradev.com/chipsxml.xsd',
'<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.oradev.com/chipsxml.xsd"
xmlns:samp="http://www.oradev.com/chipsxml.xsd"
version="1.0">
<element name="Field1">
<complexType>
<sequence>
<element name="UTI">
<complexType>
<sequence>
<element name = "U01" type = "string"/>
<element name = "U02" type = "string"/>
<element name = "U03" type = "string"/>
<element name = "U03a" type = "string"/>
<element name = "U03b" type = "string"/>
<element name = "U03c" type = "string"/>
<element name = "U04" type = "string"/>
<element name = "U05" type = "string"/>
</sequence>
</complexType>
</element>
</sequence>
</complexType>
</element>
</schema>',
TRUE, TRUE, FALSE, FALSE);
end;
////////////////////////// Table which has multiple Column //////////////////////////
CREATE TABLE chipsxmltable1 (
id number, XMLDATA XmlType)
XMLTYPE XMLDATA STORE AS OBJECT RELATIONAL
XMLSCHEMA "http://www.oradev.com/chipsxml.xsd"
ELEMENT "Field1";
///////////////////////////////// Insert Query in chipsxmltable //////////////////////////
INSERT INTO chipsxmltable VALUES(
xmltype.createxml('<?xml version="1.0"?>
<samp:Field1 xmlns:samp="http://www.oradev.com/chipsxml.xsd" >
<UTI>
<U01>No</U01>
<U02>Y</U02>
<U03>Y</U03>
<U03a>Y</U03a>
<U03b>Y</U03b>
<U03c>Y</U03c>
<U04>Y</U04>
<U05>Y</U05>
</UTI>
</samp:Field1>'));
To show the data as a field with structure:
1. Query:
Select * from chipsxmltable1;
Output:
ID XMLDATA
1 <?xml version="1.0"?>
<samp:Field1 xmlns:samp="http://www.oradev.com/chipsxml.xsd">
<UTI>
<U01>No</U01>
<U02>No</U02>
<U03>Y</U03>
<U03a>Y</U03a>
<U03b>Y</U03b>
<U03c>Y</U03c>
<U04>Y</U04>
<U05>Y</U05>
</UTI>
</samp:Field1>
2. Query: (Both the query displays the same Output)
SELECT X.xmldata.getClobVal() "XMLDATA" FROM chipsxmltable1 X;
select extract(XMLDATA, '/Field1').getstringval() "XMLDATA" from chipsxmltable1 x;
Output:
XMLDATA
<?xml version="1.0"?>
<samp:Field1 xmlns:samp="http://www.oradev.com/chipsxml.xsd">
<UTI>
<U01>No</U01>
<U02>No</U02>
<U03>Y</U03>
<U03a>Y</U03a>
<U03b>Y</U03b>
<U03c>Y</U03c>
<U04>Y</U04>
<U05>Y</U05>
</UTI>
</samp:Field1>
To show the data as a single string without structure using "getstringval()":
3. Query
select extract(XMLDATA, '//text()').getstringval() "CHIPS - XML" from chipsxmltable1 x;
OUtput:
CHIPS - XML
NoNoYYYYYY
To show the data as a single string without structure using "getclobval()":
4.Query
select extract(XMLDATA, '//text()').getClobVal() "CHIPS - XML" from chipsxmltable1 x;
Output:
CHIPS - XML
NoNoYYYYYY
To show the data in a particular tag with/Without structure (Which is not working) using "EXTRACT" function:
6.Query:
select extract(XMLDATA, '/Field1/text()').getstringval() "XMLDATA" from chipsxmltable1 x;
select extract(XMLDATA, '/Field1/UTI').getstringval() "XMLDATA" from chipsxmltable1 x;
select extract(XMLDATA, '/Field1/UTI/U01').getstringval() "XMLDATA" from chipsxmltable1 x;
select extract(XMLDATA, '/Field1/UTI/U01/text()').getstringval() "XMLDATA" from chipsxmltable1 x;
Output:
CHIPS - XML
The above queries are not fetching the value.
To show the data in a particular tag with/Without structure (Which is not working) using "EXTRACTVALUE" function:
7. Query:
select extractValue(XMLDATA, '/Field1/UTI') "XMLDATA" from chipsxmltable1 x;
select extractValue(XMLDATA, '/Field1/UTI/U01') "XMLDATA" from chipsxmltable1 x;
Output:
X
The above queries are not fetching the value.
My question is:
How to fetch values from xml tag when the value are inserted through xml schema?
Apologies if the description is not clear. Kindly let me know if further details are needed. Many thanks for your help.
Very best regards,
Godwin Jebakumar C.V.Hi,
You need to declare the namespace of each element used in the XPath expression, like this :
SQL> select extractvalue( XMLDATA
2 , '/samp:Field1/UTI/U01'
3 , 'xmlns:samp="http://www.oradev.com/chipsxml.xsd"' ) "XMLDATA"
4 from chipsxmltable1 x
5 ;
XMLDATA
No
SQL> select extract( XMLDATA
2 , '/samp:Field1/UTI'
3 , 'xmlns:samp="http://www.oradev.com/chipsxml.xsd"'
4 ).getstringval() "XMLDATA"
5 from chipsxmltable1 x
6 ;
XMLDATA
<UTI>
<U01>No</U01>
<U02>Y</U02>
<U03>Y</U03>
<U03a>Y</U03a>
<U03b>Y</U03b>
<U03c>Y</U03c>
<U04>Y</U04>
<U05>Y</U05>
</UTI>
Please see EXTRACT and EXTRACTVALUE documentation :
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions051.htm#i1006712
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions052.htm#SQLRF06173
BTW, "XMLDATA" is a pseudo-column used by Oracle. I don't know if it'll ever cause any conflict but maybe you should rename your column.
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/pseudocolumns010.htm#SQLRF00256
Regards.
Maybe you are looking for
-
ICal: 'Open in Address Book' Function for 'Attendees' does not Work
iCal lets you drag a Contact from Address Book to the 'Attendees' field of an iCal Event. (You can also put the information into the field by typing the first few letters of the person's name, and Address Book will automatically populate the field wi
-
How to set the Value in Dropdownbyindex
Hi Experts, I am New to Webdynpro-ABAP. I have one Dropdownbyindex field. I need to set the value from BAPI. how to set that values in Dropdown.. I need Basic step-by-step procedure. Regards, P.Manivannan
-
BAPI_ACTIVITYCRM_CREATEMULTI in CRM
Hi Experts, I have one query regarding the bapi - BAPI_ACTIVITYCRM_CREATEMULTI. i want to add some more fields in TABLES of this BAPI. In TABLES of this BAPI there is a table named as : EXTENSIONIN. I have tried to add some data in this field which s
-
Regarding uploadind file , pics , etc ,etc from desktop to DMS server.
Hi friends , I am a fresher and i dont know anything abt DMS .. I have given a task of uploading a file from desktop to DMS server ....Our requirement is not to use FTP server ......plzz guide me guys from very first step .... it wud b of gr8 help 2
-
Some quick and important questions about icloud that I can't find on the internet