How to build an unique identifier from XML ?
I'm having a rather simple XML structure similar to the example below. I'm storing the XML data into XMLTYPE table without modifications and constructing a set of views for SQL access to XML data on top of that. This is very basic and instructed e.g. in Breaking Up Multiple Levels of XML Data: http://download.oracle.com/docs/cd/E11882_01/appdev.112/e23094/xdb03usg.htm#autoId58
The problem is that XML data is missing an identifier for order elements that could be used as a primary key when splitting document levels (items) for relational views.
Currently I'm planning to construct such an identifier by combining a top level identifier (that is unique) with ordinal position of order elements. Unfortunately I don't know how to do that (see below). My second question is if this is a good idea at all or should something else be used instead.
I'm running Oracle 11.2.0.1.0.
create or replace view orders_view as
with xmldata as (select xmltype('<batch id="batch1">
<order>
<orderer>Joe</orderer>
<items>
<item>Standard widget</item>
</items>
</order>
<order>
<orderer>Jack</orderer>
<items>
<item>Regular widget</item>
<item>Cooling widget</item>
</items>
</order>
<order>
<orderer>John</orderer>
<items>
<item>Super+ widget</item>
<item>Super+ widget</item>
</items>
</order>
</batch>') object_value from dual)
select x1.batchid,
(select x1.batchid || '-' || x2.orderid from dual) as orderid,
x2.orderer_name,
x2.nbr_of_items
from xmldata,
xmltable('$doc/batch' passing xmldata.object_value as "doc"
columns
batchid varchar2(10) path '@id',
orderlist xmltype path 'order') x1,
xmltable('/order' passing x1.orderlist
columns
orderid varchar2(20) path '"?"', /* What to put here to get expected results ? */
orderer_name varchar2(10) path 'orderer',
nbr_of_items number path 'count(items/item)') x2;
column batchid format a10
column orderid format a10
column orderer_name format a10
select * from orders_view;Expected results:
BATCHID ORDERID ORDERER_NA NBR_OF_ITEMS
batch1 batch1-1 Joe 1
batch1 batch1-2 Jack 2
batch1 batch1-3 John 2Where ORDERID is constructed as BATCHID + "-" + the position of <order> element in the batch.
Hi,
The FOR ORDINALITY clause does exactly what you want :
http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/functions253.htm#SQLRF06232
select x1.batchid,
x1.batchid || '-' || x2.orderid as orderid,
x2.orderer_name,
x2.nbr_of_items
from xmldata,
xmltable('$doc/batch' passing xmldata.object_value as "doc"
columns
batchid varchar2(10) path '@id',
orderlist xmltype path 'order') x1,
xmltable('/order' passing x1.orderlist
columns
orderid for ordinality,
orderer_name varchar2(10) path 'orderer',
nbr_of_items number path 'count(items/item)') x2
;
Similar Messages
-
How can I generate IDOC(WPUUMS) from XML file in POSDM or in SAP Retail
Hallo Retail expert,
I have following scenario,
I have Retail Store who send me their daily sales report through Wincor Nixdorf Point of sale. There i am using standard POSLOG2 to SEEBURGER(its a middleware which act as Converter) xml format and then i post that data first in POSDM and then with BAPI i transfer or book that data to SAP Retail.
Above is the one scenario which is working.
This is the Second scenario.......
I have some external Retail store, they dont have Wincor Nixdorf POS, so they send me their Sales Report through SEEBURGER(its a middle Hardware which act as Converter) and SEEBURGER Convert that Sales data to XML format. My question is....
How can i upload or Convert a XML File into IDOC (WPUUMS)in SAP or in POSDM?
any new suggestion are welcome.
Thank you all in advance.
regards,
NielHi,
1. To get the required XML Schema, use transaction code WE60 to go to the IDoc documentation -> enter the IDoc type you want to use (WPUUMS01). Flag control and data record. Then display the XSD by choosing Documentation -> XML Schema from the menue bar. Now you can donwload the XSD for usage in Seeburger.
2. Create your mapping from the POS format into the IDoc XML format in Seeburger.
3. Create an XML File Port in ERP or POS DM using transaction code WE21.
3. To inbound the XML file from Seeburger into POS DM or SAP Retail Seeburger should trigger the function module EDI_DATA_INCOMING. Parameters for this FM are the Pathname to the XML file and the Portname you just created. Based on the port name the FM can derive the port type xml and the data will be handled as XML data.
Regards Carsten -
How to create an Excel file from XML in the Receiver File Adapter Comm Ch
How do I create an Excel file from XML in the Receiver File Adapter Communication Channel? I have my mapping done and I am outputting the file as a comma delimited csv file. However, the target can only process an Excel file (.xls). How can I generate an Excel in XI?
I saw this blog, but I don't know how to create a XSLT transformation.
/people/michal.krawczyk2/blog/2005/12/10/xi-generating-excel-files-without-the-java-nor-the-conversion-agent-not-possible
Any help would be appreciated. Thanks.Here are the steps I took to create an XSLT transformation in XI 3.0:
1. I created my source and target XSDs using XMLSpy.
2. I created the XSLT mapping from source to target in XMLSpy (referencing the souce XSD schema).
3. I created another XSLT mapping to format the target into Excel XML.
4. Import the source and target XSDs in the IR's External Definitions
5. Zip each XSLT mapping (.xls) and import it into the IR's Imported Archives
6. Reference the XSL mappings in the Interface Mapping -
How to automatically create fillable PDFs from XML
We are looking for a way to create fillable PDFs that users can enter data into and save (so the PDF needs Reader Rights applied) and we want to be able to automatically create these PDFs from XML files. We are able to do what we want in a manual fashion using Acrobat Pro v8 but we need a way to automate this due to the volume of XML files that we will need to convert.
Is there any way that this can be scripted from a command line interface with Acrobat.. like:
Acrobat.exe –input FileName.xml –output FileName.pdf –applyReaderRights true
If there is no command line options for this is there any way that this could be coded using .NET or any other programming language?You cannot automate applying usage rights with Acrobat. For that you'd need to use Adobe's LiveCycle Reader Extensions.
How exactly are you currently converting XML into fillable forms? Are you using an XDP to somehow convert to an XFA-based PDF? -
How to load images in List from Xml and view the image and resize the image & save in Flex?
Hi Friends,
I am new to flex i am doing application for image resizing rotating and save the resize image.
I want to load the images from xml file to listcontrol and show that images as a icon in the listview,then i want to drag that image to panel that time it should show it original size of the Image.then it allows user to resize ,crop,rotate the image.then i want to save the resize image,when i save the resize image it should replace the original image in the xmllist.
I am looking for some useful suggession ,if you dont mind want to see some snippet code.
It will help me to understand the concept.
Cheers,
B.VenkatesanNot in Crystal Reports Basic for Visual Studio 2008. You'll have to upgrade to CR 2008 (12.x). Then use kbase [1320507|http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_erq/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes.do] as a guide on how to do this.
Ludek -
Is there any util or ant build to generate xmlbeans from xml
hi all
is there any utility tools or ant build process that can generate xmlbeans from xml schema? thanks.exactly,
here are some libraries which are open sources;
http://java-source.net/open-source/pdf-libraries hope it's useful. :D -
How to avoid the null values from xml publisher.
I am creating a report which have the claim numbers with the values CLA001,CLA111,null, null . when i preview my report it is showing some spaces for null values also. How can i avoid the spaces from the report.
I am giving for loop for the claim numbers in the template.
<?for-each:ROW?> <?sort:CLAIMNUMBER;'ascending';data-type='text'?>
<?CLAIMNUMBER?>
<?end for-each?>
Please help me out to solve this problem.
Thanks,
vasanth.Hi Sheshu,
According to your description, you are experiencing the null values and infinity values when browser the calculated measure, right?
Based on my research, the issue is caused by that dividing a non-zero or non-null value by zero or null. In this cases, we need to check for division by zero to avoid this situation. Here is the sample query for you reference.
IIF(
Measures.[Measure B]=0,null,
Measures.[Measure A] / Measures.[Measure B]
If you have any questions, please feel free to ask.
Regards,
Charlie Liao
TechNet Community Support -
How to delete a perticular node from xml file using java code
Hii All,
Now i am trying to delete a perticular node from xml file.Like...
XML file:
<Licence>
<SERVER>
<was id="1">1</was>
<was id="2">2</was>
</SERVER>
</LICENCE>
I am working in messaging service using JABBER framework with whiteboard facility.
Here Some commands i have created to add,modify,delete nodes from xml file.They Are
1.If u want to add a new node then.
create Licence.SERVER <ss id="3">ddd</ss> lic.xml
(here u want to add a new node called "ss" under Licence.SERVER.
And lic.xml is tyhe xml file name where it was saved.
2.If u want to delete a node(Suppose <was id="1">),then the command should be
delete Licence.SERVER.was:id='"1" lic.xml
A problem arises that here it find two was attributes.And it delete the last was attribute,not the requested node.
PLEASE HELP ME IN SOLVING THIS CODE..
------------------------------------Looks like you clicked on "Post" before you pasted in the code you were talking about.
-
How can we extract unique materials from cluster tables
I want to get unique materials from CDPOS table( which is a cluster table) when i use SELECT distinct its giving me syntax error
Hi,
I don't think you can use select distict for material in table CDPOS (cluster table). You can only use distinct * or count ( * ) aggregation function.
Regards,
Ferry Lianto -
How to build semantic model table from excel 2013 budget table?
I have an excel 2013 budget table produced by finance department. The title of the table is <<Year 2015 Resource Budget>> with columns such as (Item, Budget). There is line of business app which tracks daily usage. It is SQL database which
I can access. The SQL table has columns such as Date, Item, Usage. I am asked to produce some PowerView reports using DAX.
I am thinking about using Excel 2013 PowerPivot. The following is the step of my plan.
Add excel 2013 Budget table to PowerPivot
Transform the budget table using DAX to a new table with includes date. For each item budget, the value can be evenly divided by 365. I don't know if this is possible with DAX and need advice from you
Import daily usage from SQL database into PowerPivot
Merge the imported SQL daily usage table with the transformed budget table with daily breakdown. The output table has 4 columns (Date, Item, ValueType, Value). The ValueType can be either Budget and Usage. (I also do not know if it is possible to
use DAX to merge two PowerPivot table into anther table with added new columns. If it is possible, I would love to hear from you on how to do this)
Finally, I can produce BI reports based on the newly merged table
Update: Here are more sample data.
Input Budget
<<Year 2014 Resource Budget>>
Item
Budge
Pen
365
Paper
1095
<<Year 2015 Resource Budget>>
Item
Budge
Pen
1825
Paper
1095
Bag
365
I am thinking to expand the Budget as follow but I don't how to use DAX to do it
Date
Item
Budge
31/12/2014
Pen
1
31/12/2014
Paper
3
1/01/2015
Pen
5
1/01/2015
Paper
3
1/01/2015
Bag
1
Here is the Daily Usage table
Date
Item
Usage
31/12/2014
Paper
2
31/12/2014
Pen
6
1/01/2015
Paper
10
1/01/2015
Pen
2
1/01/2015
Bag
1
I was thinking to merge the expanded Daily Budget and Daily Usage as follow for BI reporting. This was my thinking, may not a good solution using DAX
Date
Item
Type
Value
31/12/2014
Paper
Usage
2
31/12/2014
Pen
Usage
6
1/01/2015
Paper
Usage
10
1/01/2015
Pen
Usage
2
1/01/2015
Bag
Usage
1
31/12/2014
Pen
Budget
1
31/12/2014
Paper
Budget
3
1/01/2015
Pen
Budget
5
1/01/2015
Paper
Budget
3
1/01/2015
Bag
Budget
1
Off course, I need to build dimension tables for Date, Item, Item Category, and Value Type
jlHi JL,
Just for consideration, I'd:
Keep budget and actuals separately - create Fact_Y2015Budget and Fact_Actuals;
Hook both tables to same dimesnions (time; if there is no time for budget, assign it all to the first day of your 2015; line item etc. - whatever you are asked to report about)
If you can, pull usage not only for 2015, but for prior year(s) too
Create measures like [Usage Budget Atteinment YTD]:=TotalYTD(SUM([Usage]),your_time)/([Budget]*PriorYear(TotaYTD(SUM([Usage]),you_time)/CALCULATE(SUM([Usage]),DATESBETWEEN(your_first_day_of_year2015,your_last_day_of_2015))))
The calculation in #4 compares actual ("usage") to portion of budget that would have been used up if 2015 had the same seasonality as 2014... If you couldmshare specific sample, I'd buuild exact formula...
Daniel -
How to build project in NWDS from ear file?
I do know that it maynot be possible to build a project from a .ear file but I am sure there must be a way out. I am sure someone else would have faced the same problem that I am facing.
This is what happened. We had a consultant working on our ESS/MSS appplications in the studio. He made changes to a few ESS/MSS applications. However, while deploying, he did not use NWDI even though we do have NWDI available. He simply imported the .ear files in all the development, quality and production portals. Because of this, the changed source code is not available on NWDI and when I import the configuration from NWDI, I only get the old source code.
I do have al the .ear files he deployed. So, my question is, is there anyway for me to build the project from the .ear file? I do know how to decompile the CLASS files on the ear file and look at the code but I was hoping for a way to build the entire project with the changed source code in NWDS. Or Is there anyway to synchronize the NWDI source code with the deployed source code. Please respond ONLY if you have actually managed to resolve this problem.Hi Santosh,
This is hardly possible even if you have Java decompiler -- WD has a lot compile(design)-time only artifcats that are not exist in generated EAR.
Regards,
Vipin. -
How to parse and retrieve records from xml files into columns in Table
Hi
I attached the thing what i tried.
Table to hold the XML COntent:
create table xmlfile(xml_con sys.xmltype);
Inserting Xml file content into the Above table:
insert into xmlfile values(sys.xmltype.CreateXml('<Root><name>RAM</name><age>23</age></Root>'))
SQL> select * from xmlfile;
XML_CON
<Root>
<name>RAM</name>
<age>23</age>
</Root>
SQL> select extractValue(xml_con, '/Root/name') content from xmlfile;
CONTENT
RAM
This one works fine
But if the file content is as below( contains MUltiple Records)
insert into xmlfile values(sys.xmltype.CreateXml('<Root><Record><name>RAM</name><age>23</age></Record><Record><name>SAM</name><age>23</age></Record></Root>'))
SQL> select extractValue(xml_con, '/Root/Record/name') content from xmlfile;
ERROR at line 1:
ORA-19025: EXTRACTVALUE returns value of only one node
Can anyone help me 4 this issue-How to extract multiple records from the XML file inthis manner(from PL/SQL without using JAVA)
OR
If there is anyother way to do this please tell me?SQL> SELECT EXTRACTVALUE (COLUMN_VALUE, '//name') NAME,
EXTRACTVALUE (COLUMN_VALUE, '//age') age
FROM TABLE
(XMLSEQUENCE
(EXTRACT
(XMLTYPE
('<Root>
<Record>
<name>RAM</name>
<age>23</age>
</Record>
<Record>
<name>SAM</name>
<age>23</age>
</Record>
</Root>'
'/Root/Record'
NAME AGE
RAM 23
SAM 23
2 rows selected. -
How to extract a single column from XML and load in Oracle
Hi
below I have a structure of xml files , I just need to extarct <RecordReference>PQPMID:7358</RecordReference>
from file and load in to oracle ..
Please let me know how to do ..??
file content below
HoldingsRecord>
<RecordReference>PQPMID:7358</RecordReference>
<NotificationType>00</NotificationType>
<SerialVersion>
<SerialVersionIdentifier>
<SerialVersionIDType>07</SerialVersionIDType>
<IDValue>1068624X</IDValue>
</SerialVersionIdentifier>
<SerialVersionIdentifier>
<SerialVersionIDType>01</SerialVersionIDType>
<IDTypeName>PMID</IDTypeName>
<IDValue>7358</IDValue>
</SerialVersionIdentifier>
<Title>
<TitleType>02</TitleType>
<TitleText>Pittsburgh Post - Gazette</TitleText>
</Title>
<Publisher>
<PublishingRole>01</PublishingRole>
<PublisherName>Post Gazette Publishing Company</PublisherName>
</Publisher>
<OnlinePackage>
<OnlineServiceName>ProQuest</OnlineServiceName>
<Website>
<WebsiteRole>03</WebsiteRole>
<WebsiteLink>http://proquest.umi.com/pqdweb</WebsiteLink>
</Website>
<HoldingsDetail>
<JournalIssue>
<JournalIssueRole>04</JournalIssueRole>
<JournalIssueDate>
<DateFormat>00</DateFormat>
<Date>19930118</Date>
</JournalIssueDate>
</JournalIssue>
<JournalIssue>
<JournalIssueRole>06</JournalIssueRole>
<JournalIssueDate>
<DateFormat>00</DateFormat>
<Date>20080915</Date>
</JournalIssueDate>
</JournalIssue>
<EpubFormat>10</EpubFormat>
</HoldingsDetail>
</OnlinePackage>
</SerialVersion>
</HoldingsRecord>My mistake - thought you're looking for a general idea. Here's the working example:
CREATE OR REPLACE PROCEDURE import_test (i_result_file IN XMLTYPE DEFAULT XMLTYPE(bfilename('XMLDIR','my_test.xml'),nls_charset_id('ALT32UTF8')))
IS
xml_rec XMLTYPE;
v_index PLS_INTEGER;
v_rec_ref VARCHAR2(30);
BEGIN
v_index := 1;
WHILE i_result_file.Existsnode('/rec/HoldingsRecord['||To_Char(v_index)||']') > 0
LOOP
BEGIN
--- Get the line
xml_rec := i_result_file.Extract('/rec/HoldingsRecord['||To_Char(v_index)||']');
CASE WHEN i_result_file.Existsnode('rec/HoldingsRecord['||To_Char(v_index)||']/RecordReference') > 0
THEN v_rec_ref := xml_rec.extract('HoldingsRecord/RecordReference/text()').getStringVal();
DBMS_OUTPUT.put_line('v_rec_ref: '||v_rec_ref);
END CASE;
EXCEPTION WHEN OTHERS THEN
DBMS_OUTPUT.put_line('My Message: '||v_index||' '||SQLERRM);
END;
v_index := v_index + 1;
END LOOP;
END import_test;
and here is my_test.xml I have used:
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<rec>
<HoldingsRecord>
<RecordReference>PQPMID:7358</RecordReference>
<NotificationType>00</NotificationType>
<SerialVersion>
<SerialVersionIdentifier>
<SerialVersionIDType>07</SerialVersionIDType>
<IDValue>1068624X</IDValue>
</SerialVersionIdentifier>
<SerialVersionIdentifier>
<SerialVersionIDType>01</SerialVersionIDType>
<IDTypeName>PMID</IDTypeName>
<IDValue>7358</IDValue>
</SerialVersionIdentifier>
<Title>
<TitleType>02</TitleType>
<TitleText>Pittsburgh Post - Gazette</TitleText>
</Title>
<Publisher>
<PublishingRole>01</PublishingRole>
<PublisherName>Post Gazette Publishing Company</PublisherName>
</Publisher>
<OnlinePackage>
<OnlineServiceName>ProQuest</OnlineServiceName>
<Website>
<WebsiteRole>03</WebsiteRole>
<WebsiteLink>http://proquest.umi.com/pqdweb</WebsiteLink>
</Website>
<HoldingsDetail>
<JournalIssue>
<JournalIssueRole>04</JournalIssueRole>
<JournalIssueDate>
<DateFormat>00</DateFormat>
<Date>19930118</Date>
</JournalIssueDate>
</JournalIssue>
<JournalIssue>
<JournalIssueRole>06</JournalIssueRole>
<JournalIssueDate>
<DateFormat>00</DateFormat>
<Date>20080915</Date>
</JournalIssueDate>
</JournalIssue>
<EpubFormat>10</EpubFormat>
</HoldingsDetail>
</OnlinePackage>
</SerialVersion>
</HoldingsRecord>
<HoldingsRecord>
<RecordReference>PQPMID:9875</RecordReference>
<NotificationType>00</NotificationType>
<SerialVersion>
<SerialVersionIdentifier>
<SerialVersionIDType>07</SerialVersionIDType>
<IDValue>1068624X</IDValue>
</SerialVersionIdentifier>
<SerialVersionIdentifier>
<SerialVersionIDType>01</SerialVersionIDType>
<IDTypeName>PMID</IDTypeName>
<IDValue>7358</IDValue>
</SerialVersionIdentifier>
<Title>
<TitleType>02</TitleType>
<TitleText>Pittsburgh Post - Gazette</TitleText>
</Title>
<Publisher>
<PublishingRole>01</PublishingRole>
<PublisherName>Post Gazette Publishing Company</PublisherName>
</Publisher>
<OnlinePackage>
<OnlineServiceName>ProQuest</OnlineServiceName>
<Website>
<WebsiteRole>03</WebsiteRole>
<WebsiteLink>http://proquest.umi.com/pqdweb</WebsiteLink>
</Website>
<HoldingsDetail>
<JournalIssue>
<JournalIssueRole>04</JournalIssueRole>
<JournalIssueDate>
<DateFormat>00</DateFormat>
<Date>19930118</Date>
</JournalIssueDate>
</JournalIssue>
<JournalIssue>
<JournalIssueRole>06</JournalIssueRole>
<JournalIssueDate>
<DateFormat>00</DateFormat>
<Date>20080915</Date>
</JournalIssueDate>
</JournalIssue>
<EpubFormat>10</EpubFormat>
</HoldingsDetail>
</OnlinePackage>
</SerialVersion>
</HoldingsRecord>
</rec> -
How to build an MSI installer from ALP default installers
Hi,
I would like to know how can I build an MSI from the BAT+EXE installers offered by ALP?
When the install begins I can capture de .MSI bundled inside the EXE but when I have to transform that MSI in a new one with the parameters I need I can't do it...
Can somebody help me?
Thanks,
CarlosYou could create one 'installer project'
This installer project would have 4 auto populating folders, linked to each exe-folder.
With the installer you can add each autopopulating folder to your installer.
Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas
LabVIEW, programming like it should be! -
How to create an XSD file from xml
Hi,
Is there any way to generated an XSD file from an already existing XML file.
Does Jdeveloper 10g , has any feature to create the xsd file automatically?
Please advice
RegardsHere are the steps I took to create an XSLT transformation in XI 3.0:
1. I created my source and target XSDs using XMLSpy.
2. I created the XSLT mapping from source to target in XMLSpy (referencing the souce XSD schema).
3. I created another XSLT mapping to format the target into Excel XML.
4. Import the source and target XSDs in the IR's External Definitions
5. Zip each XSLT mapping (.xls) and import it into the IR's Imported Archives
6. Reference the XSL mappings in the Interface Mapping
Maybe you are looking for
-
Upgrade G3 B&W and G4 733 single processor from OS 9.2.1 to OS 10.4 Tiger
Back in August I asked several questions concerning the above, and a person named LIMNOS gave me some great info. Since both of my computers have only CD drives, he stated that I would need an external (firewire) DVD drive to do the installation. Am
-
Mac OS X (10.7.5) how to upgrade to newer OS X
Hi, I have a Mac Book Pro Rretina with OS 10.7.5 (Lion) and I need to Upgrade the OS becouse I have to install one new application that needs at list the OS 10.8 or 10.9. What I need to know is; what I have to do before doing the upgrade beside doi
-
Hi, In payroll log /ZEA - BF ESI basis, i m getting the wrong amount. How to solve this one. Pls let me know. Thanks and Regards, Revathi.
-
Control key activating wireless menu: T440s
I have a company-issued ThinkPad T440s. No admin rights, so I can't install anything. Yesterday the tech helpdesk replaced the keyboard, and ever since, when I press the lefthand Control key a black 'Change Power Settings of Wireless Radios' menus po
-
hi, Iam uploading the data using GUI_UPLOAD the file type im using is .CSV type and is having more than 255 char per record /row and hence all the data is not being uploaded .... any advise on the same to get all the data in the file into internal ta