Help on XQuery Retrieval
I'm having a problem understanding the results of a Return in a FLWOR. Basically I want the second part of the XQuery to operate on the total return of the first part.
I have a series of documents in one collection. Each document at the top level has the tag <flight-data> which has an aircraft ID as an attribute. Then within the document, there is lower level data under the tag <maintenance-raw-data> that contains fault IDs.
An example of two of the documents in the collection:
<flight-data aircraft-id = “1”>
<maintenance-raw-data fault-id=“0001”>
<maintenance-raw-data fault-id=“0002”>
<maintenance-raw-data fault-id=“0003”>
<maintenance-raw-data fault-id=“0001”>
</flight-data>
<flight-data aircraft-id = “2”>
<maintenance-raw-data fault-id=“0002”>
<maintenance-raw-data fault-id=“0003”>
<maintenance-raw-data fault-id=“0003”>
<maintenance-raw-data fault-id=“0004”>
<maintenance-raw-data fault-id=“0005”>
</flight-data>
So the intent of the xquery was to select all the data for one or more aircraft, then on that “total” selection, get a distinct list of all fault IDs. The xquery is as follows:
for $z in collection("brickdata2")/flight-data
where $z/@aircraft-id="1" or $z/@aircraft-id="2") return
for $x in distinct-values($z//maintenance-raw-data/@fault-id) return $x
Basically, I want the query to return the flight-data for both aircraft and then, on that total return, find the unique fault IDs. However, the second part operates on the unique fault IDs for each aircraft separately. It gives the unique fault IDs for the first aircraft and then the unique fault IDs for the second aircraft.
Query results with Aircraft 1 and Aircraft 2 in Where clause
Fault ID 0001
Fault ID 0002
Fault ID 0003
Fault ID 0002
Fault ID 0003
Fault ID 0004
Fault ID 0005
So we then changed the first line of the XQuery to “let $z := collection”. etc.” and then the query retrieving both aircraft works (you get 0001, 0002, 0003, 0004, 0005) “ but if you change the where clause to retrieve for only one aircraft (either one), you get the same answer (i.e., fault IDs for both aircraft).
Appreciate any help. Thanks in advance.
Basically, I want the query to return the flight-data for both aircraft and then, on that total return, find the unique fault IDs. However, the second part operates on the unique fault IDs for each aircraft separately. It gives the unique fault IDs for the first aircraft and then the unique fault IDs for the second aircraft.You can do it like the following, by first retrieving the whole sequence of attributes for both aircrafts, then applying distinct-values() :
distinct-values(
for $z in collection("brickdata2")/flight-data
where $z/@aircraft-id = "1"
or $z/@aircraft-id = "2"
return $z/maintenance-raw-data/@fault-id
)
Similar Messages
-
Can you help me to retrieve my applications. In iTunes I accidentally clicked the Restore button in the Summary screen. It restored the original settings and I lost all my applications and don't know if it is possible to retrieve them.
All apps on an iPhone, iPad, or iPod Touch should be in your iTunes library on your computer.
You can re-download all 3rd party apps and you won't be charged again for a purchased app as long as you use the same iTunes account to re-download the apps that was used to purchase the app originally.
http://support.apple.com/kb/HT2519
Do this with iTunes on your computer. After you have re-downloaded every app one by one, select Sync Apps under the Apps tab for the device's sync preferences along with selecting the apps below that you want transferred to the device followed by a sync to re-install the apps on the device. -
i lost all my massages in my emails by mistake , i want you to help me in retrieving my massages to my emails
thankxrestore the latest backup you made of the phone
-
Preferred Vendor serch help does not retrieve values
Hi,
SRM 5.0, Classic scenario
I have successfully replicated the Vendors. But I don't see the vendors in the "search help" when I create a SC.
It seems to me that I have implement the OSS note 845883. Can someone please confirm it.
With regards,
PranavHi,
Apply this note and it should fix your problem:
Note 845883 - Preferred vendor search help does not retrieve values
Some other useful OSS notes ->
968251 BBPSC02:In source of supply preferred vendor not validated
1017288 SRM@ERP : no vendor replication into follow-on documents
831833 Search help for preferred vendor does not update data
980450 Shopping cart: search help for preferred vendor
860886 Incorrect search results for deleted 'Preferred Vendor'
711197 Preferred vendor not copied from template
739531 Preferred vendor/service agent must not be changeable
733899 Complete shopping cart: Preferred vendor disappears
634794 Preferred vendor: partner not found
726102 Performance in vendor search help
647760 Shopping cart: Preferred vendor / partner not
BR,
Disha.
<b>Pls reward points for useful answers.</b> -
I downloaded my photos onto photoshop cs5 for a trial but the trial period fininshed before I was ready. Can anyone help me to retrieve my lost photos.
What are you talking about?
Photoshop is not a "container" for images, those must have existed somewhere else. (With the exception of newly created unsaved images, but as you claimed you downloaded them this case does not seem to apply.) -
Need Urgent help Error while retrieving a password for credential: ReaderRi
I am receving the following error while deploying my web dynpro application containig a adobe form .The issue is that when i perform teh following test
Enter the following URL in the browser
http://<server>:<port>/AdobeDocumentServices/Config
The web page of the web service AdobeDocumentServices is displayed. Choose Test.
Choose rpdata(test )
Choose the Send button without entering any parameters
Enter the user name and password
User Name: ADSUser
Password: <Your admin password>
Choose Submit
I get the version number
but when i deploy the application i get this eror
com.sap.tc.webdynpro.clientserver.adobe.pdfdocument.base.core.PDFDocumentRuntimeException: Failed to UPDATEDATAINPDF
at com.sap.tc.webdynpro.clientserver.uielib.adobe.impl.InteractiveForm.afterHandleActionEvent(InteractiveForm.java:398)
at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.afterApplicationModification(ClientApplication.java:1132)
at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.afterApplicationModification(ClientComponent.java:887)
at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.doRespond(WindowPhaseModel.java:573)
at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.processRequest(WindowPhaseModel.java:152)
at com.sap.tc.webdynpro.clientserver.window.WebDynproWindow.processRequest(WebDynproWindow.java:335)
at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:143)
at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.doProcessing(ApplicationSession.java:299)
at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessingStandalone(ClientSession.java:752)
at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessing(ClientSession.java:705)
at com.sap.tc.webdynpro.clientserver.session.ClientSession.doProcessing(ClientSession.java:261)
at com.sap.tc.webdynpro.clientserver.session.RequestManager.doProcessing(RequestManager.java:154)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:62)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doGet(DispatcherServlet.java:46)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:387)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:365)
at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:944)
at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:266)
at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95)
at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:160)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
Caused by: com.sap.tc.webdynpro.clientserver.adobe.pdfdocument.base.core.PDFDocumentRuntimeException: PDFDocument Processor failed to process Render Request.
at com.sap.tc.webdynpro.clientserver.adobe.pdfdocument.base.core.PDFDocumentProcessor.process(PDFDocumentProcessor.java:55)
at com.sap.tc.webdynpro.clientserver.adobe.pdfdocument.base.core.PDFDocumentInteractiveFormHandlingContext.execute(PDFDocumentInteractiveFormHandlingContext.java:98)
at com.sap.tc.webdynpro.clientserver.adobe.pdfdocument.base.core.PDFDocumentInteractiveFormHandlingContext.execute(PDFDocumentInteractiveFormHandlingContext.java:121)
at com.sap.tc.webdynpro.clientserver.uielib.adobe.impl.InteractiveForm.afterHandleActionEvent(InteractiveForm.java:342)
... 29 more
Caused by: com.sap.tc.webdynpro.pdfobject.core.PDFObjectRuntimeException:
Processing exception during a "UsageRights" operation.
Request start time: Wed Oct 03 14:43:25 PDT 2007
com.adobe.ProcessingError: Error while retrieving a password for credential: ReaderRightsHi Namit,
Have you installed a credential file to your ADSServer?
This is required to apply the usageRights onto the PDF.
You need to install the ReaderRights credential file. Follow the steps from this URL:
Re: Interactive form application error
Make sure that the password and the expiry date of the ReaderRights credential file are valid.
Hope this helps. -
Help needed in retrieving data
Hi,
I have a table
ego_attrs which stores column names of a table ego_mtl_sy_items_ext_b.
ego_attrs ego_mtl_sy_items_ext_b
col1 col1 col2 col3
col2 x1 x2 x3 (Data)
col3
I'm supposed to retrieve the column names from ego_attrs and compare with the columns of ego_mtl_sy_items_ext_b table and retrieve the entire row and update another table(cn_comm_lines_api_all) by the data extracted from ego_mtl_sy_items_ext_b table. Can anyone help me on this.
Thanks,This may not be the correct answer. But I think it is possible with the help of functions (which returns the primary key of the table), retrieve the data with that primary key and with the help of execute immediate statements you can update the row.
store the values in some variables and insert those values in your new table. -
PLEASE HELP on how retrieve async callback
Hi all,
I have some question on calling and retrieving results from BPEL processes
First of all I would like to know the meaning of http://set.by.caller written on service port in the WSDL's process.
Why can I see these info (service & binding) only after deploy, and not in design phase?
And above all, how can I set it and use? How can I redirect the result of a process to a service, I've read on Dev Guide that it is possible, but i've found nowhere how!!!
I've implemented a service and then I've invoked my process through a java client, inserting in the header MessageID and ReplyTo as specified by WS-Addressing, but the process seems to ignore it!!
Furthermore I've seen in 113.ABCARouting example an operation "receive" on WSDL's process, I've attempted to do the same thing and then to call that port using a java class, but i get a Fault as a result,
<faultcode>soapenv:Server.generalException</faultcode>
<faultstring>Cannot find binding operation definition of soapAction 'receive' in http://...
no binding for receive operation. But it works in 113.ABCARouting, where is the sorcery?!
Thanks in advanced for help... I really need
Lisa417 views and no answer :(
please some one help
Lisa -
[ALSB 3.0] help help about xquery transformation
Hi all,
I should transform a xml doc from
<val_date>20081004</val_date>
<par>
<key>rpp</key>
<value>10</value>
</par>
<par>
<key>curry</key>
<value>CHF</value>
</par>
to
<val_date>20081004</val_date>
<par>
<key>rpp</key>
<value>10</value>
</par>
<par>
<key>curry</key>
<value transcoder="CURRENCY">CHF</value>
</par>
I'm using WorkspaceStudio but I've some troubles in my xquery transformation.
I tried as below:
<ns1:val_date>{ data($dummyProviderEvent/ns0:val_date) }</ns1:val_date>
for $par in $dummyProviderEvent/ns0:par
return
<ns1:par>
<ns1:key>{ data($par/ns0:key) }</ns1:key>
if ($par/ns0:key="curry") then <ns1:value transcoder="CURR">{ data($par/ns0:value) }</ns1:value>
else <ns1:value>{ data($par/ns0:value) }</ns1:value>
</ns1:par>
</ns1:dummyEvent>
but is not working:
i) WorkspaceStudio raises a warning at 'else' line with message "XML element does not match the target schema"
ii) testing the transformation it seems that if condition is always true
Could you help me to find out the correct solution ?
Regards
ferpI know there were some changes to the packaging of the public API in 3.0. You may want to be sure you include all the necessary jar in your classpath. I think there is another post in the forum covering this.
Gregory Haardt
ALSB Prg. Manager
[email protected] -
Hello Friends,
I am trying to do a XQuery transformation which does not like straight one to one. I am not an expert so I don't know what I am trying to achieve is capable or not.
So please Guys me ...
My Source Element are like :
<Node1>
<Node2>
<Node3>
<Node4>
<Node5>
<Node6>
My Destination elements are :
<Dest1>
<Dest2>
<Dest3>
<Dest4>
Now in transformation I need put some logic like this :
1. check if node1 and node 2 has some data then copy node1 + node 2 data in Data1 othwise if node 2 present then copy only node 2 data.
2. similary if node 1 and node 2 node are not present then copy node 3 (if present) in dest 1 and node 4 data in dest2 subsequently.
So, like this different combination of source nodes data will map to 4 destination nodes.
I am trying my hands but no success yet.
So please help me.If it is possible then can anyone write a simple example for this.
Thanking in Anticipation.For the conditional part check http://www.w3schools.com/xquery/xquery_syntax.asp
and to combine the nodes check http://www.xqueryfunctions.com/xq/fn_concat.html
hth,
Peter Paul -
Hi,
I am having a replace in proxy service to transform AIA format to custom format.
I have a XQuery file for this.
In Replace :
XPath - .
In variable - body
Expression - browsed the xquery resource
- in bind variables:
variable name - createssalesorder1
binding - $body (what should I give for binding??)
Replace node contents
The XQuery file is :
(:: pragma bea:global-element-parameter parameter="$createSalesOrder1" element="ns5:CreateSalesOrder" location="../../aia_11_1/AIAComponents/EnterpriseObjectLibrary/Core/EBO/SalesOrder/V2/SalesOrderEBM.xsd" ::)
(:: pragma bea:global-element-return element="ns1:order" location="../schemas/ean.ucc/order/Order.xsd" ::)
declare namespace ns2 = "http://xmlns.oracle.com/EnterpriseObjects/Core/Custom/EBO/SalesOrder/V2";
declare namespace ns1 = "urn:ean.ucc:order:2";
declare namespace ns4 = "http://xmlns.oracle.com/EnterpriseObjects/Core/Common/V2";
declare namespace ns3 = "http://xmlns.oracle.com/EnterpriseObjects/Core/Custom/Common/V2";
declare namespace ns0 = "urn:ean.ucc:2";
declare namespace ns5 = "http://xmlns.oracle.com/EnterpriseObjects/Core/EBO/SalesOrder/V2";
declare namespace xf = "http://tempuri.org/df.om_1.0/transforms/AIASalesOrder2GS1OrderProxy/";
declare function xf:AIASalesOrder2GS1OrderProxy($createSalesOrder1 as element(ns5:CreateSalesOrder))
as element(ns1:order) {
<ns1:order>
<orderIdentification>
<uniqueCreatorIdentification>{ fn:string($createSalesOrder1/ns4:Identification/ns4:ID/@schemeID) }</uniqueCreatorIdentification>
<contentOwner>
<additionalPartyIdentification>
<additionalPartyIdentificationType>BUYER_ASSIGNED_IDENTIFIER_FOR_A_PARTY</additionalPartyIdentificationType>
</additionalPartyIdentification>
</contentOwner>
</orderIdentification>
<orderPartyInformation>
<seller>
<additionalPartyIdentification>
<additionalPartyIdentificationType>SUPPLIER_ASSIGNED_IDENTIFIER_FOR_A_PARTY</additionalPartyIdentificationType>
</additionalPartyIdentification>
</seller>
</orderPartyInformation>
</ns1:order>
declare variable $createSalesOrder1 as element(ns5:CreateSalesOrder) external;
xf:AIASalesOrder2GS1OrderProxy($createSalesOrder1)
When I test the proxy service using console, I get
BEA-382513: OSB Replace action failed updating variable "body": Error parsing XML: {err}XP0006: "element {http://schemas.xmlsoap.org/soap/envelope/}Body { {http://www.w3.org/2004/07/xpath-datatypes}untypedAny }": bad value for type element {http://xmlns.oracle.com/EnterpriseObjects/Core/EBO/SalesOrder/V2}CreateSalesOrder { {http://www.w3.org/2001/XMLSchema}anyType }
I am new to XQuery and any help on where am I going wrong on this?
Also is there an example/tutorial for the above scenario?
Thanks
GaneshHello Ganesh,
Try with "$body/*" in the binding.
If it does not work then please paste the input xml of the proxy here. Actualiy, your proxy's input xml must be having an element of type "ns5:CreateSalesOrder" and you have to give that element's X-path in Xquery binding.
Regards,
Anuj -
Help needed to retrieve vital voicemail.
Can anyone help?
I saved my voicemail for 7 days, it came in last Sat at 1734, i had reason to listen to it on Thursday and pressed 7 again after it to save it for another 7 days, with the intention of saving it for another 7days and so on.
I went to retrieve it tonight again and it wasn't there, this message is vital, i checked on the web to see how to retrieve deleted voicemails and followed the instructions but when i press the voicemail option it calls it.
i canont do a reset as i have too much on my phone as it's a company phone, i don't want to reset the network settings as i am unsure if they just come back as per normal.
Any suggestions on how to retrieve this voicemail would be appreciated, i called vodafone to see if a message could be retrieved and was told no.
I am desperate for help.
thankswjosten,
thanks i did, i called vodafone right away when i noticed it was gone despite saving it, and they just said no, you cannot retrieve it.
Ths should be a warning to users that despite saving it, and it sayin "this message is saved for 7 days" it doesn't!
Do you know how to get voicmail virtual and if so will it have the deleted message on it.
thanks for your help. -
I have 2 xml documents Team and Player
Here is how they look like
team.xml
<Teams>
<Team>
<Lost>59</Lost>
<Name>NewYork</Name>
<Won>103</Won>
</Team>
<Team>
</Team>
<Teams>
player.xml
<Players>
<Player>
<Age>24</Age>
<Team>NewYork</Team>
<BOB>67</BOB>
<SOT>265</SOT>
<IPT>229.3</IPT>
</Player>
<Player>
</Player>
<Players>I want to write a xquery to dsiplay for each team; the number of good* players, the avg age of good players, the number of total players and avg age of total players.
The criteria for a good player is (BOB + SOT) / IPT < 0.91.
This what I tried
for $x in distinct-values (doc("team.xml")/Teams/Team/Team)
let $y:= doc("player.xml")/Players/Player[Team=$x]
return
<Team>
<Team_Name>{data($x)}</Team_Name>
<Total_players>{count($y)}</Total_players>
<Average_Age>{avg($y/Age)}</Average_Age>
</Team>Using this I get the the number of total players and avg age of total players. However, i'm not sure how I can modify this to return the information about good players as well.
Can someone please help me with this.
Thanks.Try something like this
xquery version "1.0";
<Table>
for $x in distinct-values (doc("team.xml")/Teams/Team/Name)
let $y:= doc("player.xml")/Players/Player[Team=$x]
let $z:= $y[(BOB + SOT) div IPT < 0.91]
return
<Team>
<Team_Name>{data($x)}</Team_Name>
<Total_players>{count($y)}</Total_players>
<Good_players>{count($z)}</Good_players>
<Average_Age>{avg($y/Age)}</Average_Age>
{for $p in $y
return
<PlayerRating>
{$p/Age}
<GoodPlayer>{$p/BOB + $p/SOT div $p/IPT lt 0.91}
</GoodPlayer>
<PlayerScore>
{$p/BOB + $p/SOT div $p/IPT}
</PlayerScore>
</PlayerRating>
</Team>
</Table>HTH,
chris
Edited by: chrisis on Nov 28, 2009 1:59 PM -
I have a table as below ; and i get to a record in the table using the primary key
create table raees_test
unique_rec_id varchar2(16) not null primary key ,
racn_nbr number(5),
blob_value blob,
invoice_data SYS.XMLTYPE
I want to query the xml type column using Xquery where I want to reach to it through the unique_rec_id
please let me know how to implement the query
Thanks
RaeesBasically, I want the query to return the flight-data for both aircraft and then, on that total return, find the unique fault IDs. However, the second part operates on the unique fault IDs for each aircraft separately. It gives the unique fault IDs for the first aircraft and then the unique fault IDs for the second aircraft.You can do it like the following, by first retrieving the whole sequence of attributes for both aircrafts, then applying distinct-values() :
distinct-values(
for $z in collection("brickdata2")/flight-data
where $z/@aircraft-id = "1"
or $z/@aircraft-id = "2"
return $z/maintenance-raw-data/@fault-id
) -
Please help with username retrieval failed error
Not sure if this is the appropriate forum for this
We work in a managed environment. In the past week the domain has changed from Manitoba to ME. Yesterday I tried to connect to my local personal Oracle database 9iv2 with SQL*Plus and got an ORA-(TNS)-12631 USERNAME RETRIEVAL FAILED error. However I can connect with iSQL and Oracle Forms. Go figure? Everything was working well on Friday. Our systems person cannot find anything in the logs to indicate other changes that might have been made to our environment.
I've changed all occurrences of manitoba to me in the c:\oracle\ora92\network\admin\tnsnames.ora, listner.ora and snmp_rw.ora files as well as any others of the same name in other directories (just in case).
This has not solved the problem. Can anyone suggest what else might need fixing/editing???? Registry??
I activated the logs and traces but don't understand them well enought to find clues to the problem.
At the same time, we also experienced problems with our oracle servers, but they are now back on line. I was told that the listners stopped working.
I still cannot connect to my personal oracle, so any help/suggestions would be very much appreciated
Thank you
glennproblem has been solved by changing
sqlnet.authentication_services=(NTS)
to
sqlnet.authentication_services=(none)
BUT: I still don't know why our two servers and my personal oracle got derailed all on the same weekend. I'd still appreciate some suggestions.
glenn
Maybe you are looking for
-
Custom infotype in SAPHRActiveSync - supervisor field
Has anyone been successful in adding a custom infotype in the SAP HR ActiveSync adapter to get the values? I added it to the schema and did the mappings in the wofkflow, but its always returning null value. I need to add supervisor field and work add
-
Whats the esiest way to create a new photo album in the photo option?
help i cant figure out to create new photo albums on the iphone
-
Fade effect: how to do with "onEnterFrame"?
Hi, I have a map with each city represented as a dot (MC). When you mouse over the dot, another MC with more city details/text quickly fades in, and fades out when you roll out. But I can't get the full fade effect working. Need your advice... In the
-
Two Cinema Displays + 17" MBP?
Hey all, Looking to connect two 23" Cinema Displays (the older aluminium version with DVI) to a 2011 17" MBP with an i7/8GB RAM/AMD 1GB video card/Thunderbolt...is it possible? I know about the Matrox DualHead but was wondering if there are any cheap
-
Maximum length / duration for hinting movies
Dear all, we have long movies (MPEG-4, 15 fps, 240 x 180). We never succeed to hint for streaming a movie longer than 6h 38m !!! Yes, this seems to be the magic length limit. I does not seem to be depending on the size, as we tried to drasically redu