Guest
(Guest)
January 7, 2002, 9:37pm
1
I am trying to figure out how to select the last node in a result set from Tamino. I can’t figure this out, I have tried doing the following query:
http://mercury/tamino/plumbingpermits/plm/govmedoc?_xql=/govmedoc/PermitDetails/CaseNumber[last()]
This query works, but it returns every document in the result set. I only want the last document so I can get the last CaseNumber to generate a new CaseNumber.
Thanks for your answers! Knute Hestness City of Tacoma
system
(system)
January 8, 2002, 3:29am
2
Guest
(Guest)
January 8, 2002, 5:27am
3
Alexander, Thanks for your response, I tried the query and it returns the very first document in my collection, any other ideas?
Here is the resultset: ------------------------------------------------xql:query /govmedoc/PermitDetails/CaseNumber sortby (. desc)</xql:query> - <ino:message ino:returnvalue=“0”> ino:messageline XQL Request processing</ino:messageline> </ino:message> - xql:result PLM2000-00001 </xql:result> - <ino:cursor ino:count=“4383”> <ino:first ino:href=“?_XQL(1,1)=/govmedoc/PermitDetails/CaseNumber sortby (. desc)” /> <ino:next ino:href=“?_XQL(2,1)=/govmedoc/PermitDetails/CaseNumber sortby (. desc)” /> <ino:last ino:href=“?_XQL(4383,1)=/govmedoc/PermitDetails/CaseNumber sortby (. desc)” /> </ino:cursor> - <ino:message ino:returnvalue=“0”> ino:messageline XQL Request processed</ino:messageline> </ino:message> </ino:response> ------------------------------------------------- Knute Hestness
Currently the query returns sorted (descending) CaseNumber Nodes per document, in the natural Document order. This returns the highest valued CaseNumber Node from the first document, which is not what you want.
You need to sort the documents into descending CaseNumber order before extracting the CaseNumber node from the last document. So you could try:
http://mercury/tamino/plumbingpermits/plm/govmedoc?_xql(1,1)=/govmedoc sortby(PermitDetails/CaseNumber desc)/PermitDetails/CaseNumber
system
(system)
January 8, 2002, 5:31pm
5
Yeah, true mistaken a little and do not forget standard index for CaseNumber node
Guest
(Guest)
January 9, 2002, 4:46am
6
I have tried the current query and it still gives me the 1 record out of 4383. It seems like such a simple request, find the last node in the collection.
Here is the result set from the latest query:
<?xml version="1.0" encoding="iso-8859-1" ?> - <ino:response xmlns:ino=“http://namespaces.softwareag.com/tamino/response2 ” xmlns:xql=“XQL FAQ (XML Query Language - Frequently Asked Questions) ”> xql:query /govmedoc sortby(PermitDetails/CaseNumber desc)/PermitDetails/CaseNumber</xql:query> - <ino:message ino:returnvalue=“0”> ino:messageline XQL Request processing</ino:messageline> </ino:message> - xql:result PLM2000-00001 </xql:result> - <ino:cursor ino:count=“4383”> <ino:first ino:href=“?_XQL(1,1)=/govmedoc sortby(PermitDetails/CaseNumber desc)/PermitDetails/CaseNumber” /> <ino:next ino:href=“?_XQL(2,1)=/govmedoc sortby(PermitDetails/CaseNumber desc)/PermitDetails/CaseNumber” /> <ino:last ino:href=“?_XQL(4383,1)=/govmedoc sortby(PermitDetails/CaseNumber desc)/PermitDetails/CaseNumber” /> </ino:cursor> - <ino:message ino:returnvalue=“0”> ino:messageline XQL Request processed</ino:messageline> </ino:message> </ino:response>
Knute Hestness
This would suggest that sortby isn’t sorting the records. Can you please confirm this by running the query…
http://mercury/tamino/plumbingpermits/plm/govmedoc?_xql=/govmedoc sortby(PermitDetails/CaseNumber desc)
…and look at the CaseNumber value in each returned document. If these values are not in the expected sequence, can you please post your schema and a couple of your xml documents to the forum. Thanks.
Guest
(Guest)
January 9, 2002, 11:40pm
8
Here is the DTD that the Schema is based on:
------------------ Sample Document from Tamino:
<?xml version="1.0" encoding="iso-8859-1" ?> - <ino:response xmlns:ino=“http://namespaces.softwareag.com/tamino/response2 ” xmlns:xql=“XQL FAQ (XML Query Language - Frequently Asked Questions) ”> xql:query /govmedoc[@ino :id=‘5’]</xql:query> - <ino:message ino:returnvalue=“0”> ino:messageline XQL Request processing</ino:messageline> </ino:message> - xql:result - - 5 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL - 3245000440 NULL - 3219 N 8TH ST NULL NULL PIERCE TACOMA - PLM2000-00006 PLM2000-00006 NULL 1/4/00 1/4/00 3/27/00 A First Dump REP NULL 1 NULL NULL NULL NULL NULL NULL </xql:result> - <ino:message ino:returnvalue=“0”> ino:messageline XQL Request processed</ino:messageline> </ino:message> </ino:response>
The DTD doesn’t really help. Can you please post your Tamino Schema (Use the Schema Editor; Database, Get Schema… and File, Save As …). Thanks.
Guest
(Guest)
January 10, 2002, 9:37pm
10
Here is the Schema you requested, thanks for your help.
theSchema.xml (12.4 KB)
Thanks for the schema. The node you are trying to sort by does not have a standard index, so sort will not work (see Alexander’s second post above).
Here is a modified schema that should work.
theSchema_modified.xml (12.4 KB)
Guest
(Guest)
January 11, 2002, 10:42pm
12
Thanks for your help, I now have Amit Mangal from Software AG who is helping me with this problem. We are redesigning the schema and breaking out the nodes to seperate doc types and then linking them with GUID’s.
Knute Hestness City of Tacoma