Retrieving specific document using explicit index lookup

The best way to retrieve a specific document seems to be using XmlContainer::getDocument, thus using the default index.
However, I may not have the document name, but instead an ID I have defined a unique index for.
Of course, I can use the XQuery interface to retrieve the document, and it's fast.
It's faster, though, to directly use an index. I can use XmlContainer::lookupIndex in order to do this; it takes an optional parameter "value", and the documentation for 2.3.10 says: "Provides the value to which equality indices must be equal. This parameter is required when returning documents on equality indices, and it is ignored for all other types of indices."
However, the documentation also says that XmlContainer::lookupIndex is deprecated, "in favor of using XmlManager::createIndexLookup and XmlIndexLookup::execute". That recommended approach does not seem to provide a way to look up a specific value. It seems I have to iterate over the index, which is not what I want. Am I missing something?
Michael Ludwig

George,
thanks a lot - should have found this myself, I guess. Working example following:
use strict;
use warnings;
use Sleepycat::DbXml 'simple';
my $id = shift or die "usage: $0 <ID>\n";
my $contfile = $ENV{HOME} . '/dbenv/tv.dbxml';
my $iuri = ''; my $iname = 'ID';
my $istrat = 'unique-node-attribute-equality-decimal';
eval {
    my $mgr = XmlManager->new;
    my $cont = $mgr->openContainer($contfile, Db::DB_RDONLY);
    my $sval = XmlValue->new(XmlValue::DECIMAL, $id);
    my $idx = $mgr->createIndexLookup($cont, $iuri, $iname, $istrat, $sval);
    my $ctx = $mgr->createQueryContext(
        XmlQueryContext::LiveValues,
        XmlQueryContext::Lazy);
    my $res = $idx->execute($ctx);
    while ($res->hasNext) {
        $res->next(my $val);
        print $val;
my $ex;
if ($ex = catch XmlException) {
    die join "\n", ref $ex, $ex->what,
        'Exception Code: ' . $ex->getExceptionCode,
        'DbErrno: ' . $ex->getDbErrno;
elsif ($ex = catch std::exception) { die join "\n", ref $ex, $ex->what }
elsif ($@)                         { die $@ }For an alternative approach using setLowBound(), apply the following diff:
12c12,13
<     my $idx = $mgr->createIndexLookup($cont, $iuri, $iname, $istrat, $sval);
my $idx = $mgr->createIndexLookup($cont, $iuri, $iname, $istrat);
$idx->setLowBound( $sval, XmlIndexLookup::EQ );Thanks,
Michael

Similar Messages

  • Exception while retrieving deleted document using metadata based query

    Hi,
    I am using dbxml 2.4.11 on Mac OS 10.5. My xml documents are stored in the dbxml with some metadata. Index on metadata is built. After delete a document I get an exception (error code is DATABASE_ERROR) while trying to use metadata based query:
    com.sleepycat.dbxml.XmlException: Error: DB_NOTFOUND: No matching key/data pair found, errcode = DATABASE_ERROR
    at com.sleepycat.dbxml.dbxml_javaJNI.XmlResults_hasNext(Native Method)
    at com.sleepycat.dbxml.XmlResults.hasNext(XmlResults.java:136)
    at gov.nasa.gsfc.md.mms.dbserver.server.XmlDbServerImpl.selectDocuments(XmlDbServerImpl.java:111)
    at gov.nasa.gsfc.md.xdba.server.ApplicationServiceImpl.findDocument(ApplicationServiceImpl.java:99)
    the code used to query:
    query = ... /DIF[dbxml:metadata('md:Id')='1234']
    // Perform the query.
    XmlResults results = getXmlManager().query(query, context);
    while (results.hasNext()) {
    XmlValue xmlValue = results.next();
    DocumentDTO documentDTO = new DocumentDTO();
    XmlDocument xmlDocument = xmlValue.asDocument();
    XmlMetaDataIterator metadataIt = xmlDocument.getMetaDataIterator();
    XmlMetaData md = metadataIt.next();
    while (md != null) {
    String name = md.get_name();
    String value = md.get_value().asString();
    NameValuePair nameValuePair = new NameValuePair(name,value);
    documentDTO.addToMetadataList(nameValuePair);
    md = metadataIt.next();
    retVal.add(documentDTO);
    counter = counter + 1;
    results.delete();
    context.delete();
    As name and value of the metadata I use kind of Id. If I use the query with a never before existing Id, I get the expecting error code DOCUMENT_NOT_FOUND, which is ok.
    Anybody has an idea why?
    Thanks a lot,
    Hoan.

    Hi George,
    I use now version 2.4.16, built a new database, but I can't found any records using the code mentioned above. First I thought there would be problem on Mac, tried to install the whole database and app on linux, but the problem still persists. The query I am using is:
    collection('////usr/server/gcmdx/xmldb/data/live.bdbxml')/DIF[dbxml:metadata('md:docType')='DIF' and dbxml:metadata('md:internalId')='456']
    (Switching back to 2.4.11, I find the records inserted)
    I can send a record if you want.
    Thank you for your help,
    Hoan.

  • Specific document using an action question

    Would I be right in assuming that there is NO way that an action can pick a specific open document by name (to then perform an action on). As you can't rely on "previous" or "next" documents - as the number of open documents is unknown. (unlike scripting where you can getByName). I'm pretty sure this is the case, but I just want to double check. Cheers.

    Objects can be selected in an Action if they have a "note" assigned to them, which is done using the Attributes panel. Since you would surely know if your objects had notes already, I doubt you'll be able to do this, unfortunately.
    Mike D.

  • How to retrieve the users that are following a document using JSOM / REST APIs in SharePoint 2013

    Hi everyone,
    Does anyone know how to use JSOM / REST APIs to retrieve the users that are following a specific document in SharePoint 2013? 
    Thanks in advance,
    Nam

    Hi Nam,
    Please use the sample code to get the followers for the document. Courtesy: Mokhtar
    Bepari 
    using Microsoft.SharePoint.Client;
    using Microsoft.SharePoint.Client.Social;
    ClientContext clientContext = new ClientContext("http://URL");
    SocialFollowingManager followingManager = new SocialFollowingManager(clientContext);
    SocialActorInfo actorInfo = new SocialActorInfo();
    actorInfo.ContentUri = "<documenturl>"; //set the document url.
    actorInfo.ActorType = SocialActorType.Document;
    //By using the GetFollowed method you can get the people who the current user is following.
    ClientResult < SocialActor[] > followedResult = followingManager.GetFollowed(SocialActorTypes.Users);
    //By using the GetFollowers() method you can get the people who are following the current user.
    ClientResult < SocialActor[] > followersResult = followingManager.GetFollowers();
    clientContext.ExecuteQuery();
    Once you get the resultset you can iterate like below:
    foreach(SocialActor actor in followedResult)
    string name = actor.Name;
    string imageURL = actor.ImageUri;
    Please 'propose as answer' if it helped you, also 'vote helpful' if you like this reply.

  • Function Module to retrieve appraisal data using a Document ID (GUID)

    Hi,
    Is there a function module to retrieve appraisal data of a document using the document ID (GUID). The new Document ID is of 32 char length. I am working on version 4.7 110.
    Edited by: Beril PC on Jul 16, 2008 8:01 AM

    check for functiona modules starting with phap* or hap*
    Regards,
    Divya

  • Fuzzy Lookup cannot use existing index

    Hi all,
    we have upgraded to SQL Server 2008 R2 from SQL Server 2008 and since then our fuzzy matching process has failed when trying to re-use existing index with the error:
    [Fuzzy Lookup] Progress: Warming caches - 0 percent complete
    [Fuzzy Lookup [9824]] Warning: Catastrophic failure
    [SSIS.Pipeline] Error: component "Fuzzy Lookup" (9824) failed the pre-execute phase and returned error code 0x8000FFFF.
    Warming cache property is set to False though.
    Has anyone experienced the same error?
    When building a new index fuzzy matching runs without problems.
    Thanks a lot.
    Fran

    Hi Fran,
    The error may occur due to a memory issue such as the Fuzzy Lookup task consumes high memory buffers. Please try the following steps:
    Run the package in 64-bit mode by setting the Run64BitRuntime property of the project to True.
    Right click the Fuzzy Lookup task and click “Show Advanced Edior…”
    Switch to the Component Properties tab, and set the following properties:
    CopyReferenceTable: 0
    DropExistingMatchIndex: 0
    WarmCaches: False
    Hope this helps.
    Regards,
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • Need SP_TN for specific user must use specific document series and warehouse in Marketing Documents

    Hi experts,
       I need SP_TN for specific user must use specific document series and warehouses in Marketing Documents SAP B1.
       Kindly give solution ASAP.
    Thanks in advance

    Hi Nagarajan,
       It show (1) Not allowed to add PO.
       I used the following SP
    IF  @object_type = '22' AND @transaction_type IN (N'A',N'U')
    BEGIN
    IF Exists
    (SELECT T0.DocEntry FROM POR1 T0 INNER JOIN OPOR T1 ON T0.DocEntry = T1.DocEntry
    WHERE  T1.DocType = 'I' AND T1.Series = '142' OR T1.Series = '145' AND T0.[WhsCode] = 'STEX-01'
    or T0.[WhsCode] = 'STNEX-01' and T1.[UserSign] ='1'
    and T1.docentry = @list_of_cols_val_tab_del)
    BEGIN
    SELECT @error = 1
    SELECT @error_message = 'Not allowed to add PO'
    END
    END
    warm regards,
    Guhan

  • Using Content Query webpart for specific Document library with multiple managed metadata - Document with multiple metadata tags not showing up

    Hi,
    I am having an issue where when I insert a Content Query webpart into a page, and filter to managed metadata, all the right documents show up except one document that happens to have two metadata tags attached to it.  The content query webpart is set
    to only look through a specific document library.  I'm not sure what I am doing wrong.
    Here is the one document with two metadata tags:
    Below is the Content Query:

    Hi,
    As I understand, you did not get the results with multiple metadata tags through Content Query web part in SharePoint 2013.
    Check things below:
    1. Check if you have set the item limit more than the display items in Presentation section of the web part. If the item number more than item limit, the rest items will not show.
    2. Check if the item you cannot find uses the content type you have set in the content type section of content query web part.
    When you edit the properties of the item, you will see the content type the item is using.
    Best regards
    Sara Fan
    TechNet Community Support

  • Total space used by indexes for specific schema

    Hi all.
    Running Oracle 9.2.0.4.
    Is there a way I can see how much index space is used for a specific schema? I query index_stats and it returns 0 rows but my stats were updated this morning.
    Any input is apreciated.
    Thanks

    Hi,
    Index space and index stats are two different things.
    What you are interested to know?
    1) How much space is used by index for a particular schema
    select sum(bytes)/1024/1024 from dba_segments
    where (owner, segment_name) in
    (select owner, index_name from dba_indexes where
    owner = '<schema you are interested in>')2) Is the stats gathered on index
    select index_name, last_analyzed, num_rows from dba_indexes where
    owner = <'schema you are interested in >'Regards
    Anurag

  • Create a document based on specific document template using JavaScript (ECMA Script/REST API/SP Services)

    Hi,
    I have requirement to create a new document based on specific document template available in document library. Able to set the specific content type but the respective document template not being applied. I am trying with ECMAScript, REST API and SPServices
    but no luck for now. Please help me.
    Thanks,
    JP

    Hello,
    I have already tried your solution, however in that case I get the error - "UncaughtSys.ArgumentNullException: Sys.ArgumentNullException:
    Value cannot be null.Parameter name: context"...
    Also, I tried removing SP.SOD.executeFunc
    from my code, but no success :(
    Kindly suggest !!!
    Vipul Jain

  • Retrieve session and document using webisessionid and document token

    Hi,
    I am trying to open a document in a session which is already in progress. In another words, I have the cdzSessionId (string returned by ReportEngine.getServerInstance()) and the documentToken of the required document. I could not find the steps or API or open this document using the same session (without creating a new one).
    Can someone help me with that, by posting some code samples or guideline on how to do that?
    I know this must be possible, because we load the webi-applet in our jsp and it takes this values to work on the document.
    Thanks in advance,
    Santosh

    Ok, so how can I achieve my goal of taking some extra steps when user hits a button ?
    The editor saves the report with data when user saves it. I know there would be a valid reason to do that, but it raises a compliance issue with our regulations as the report could be shared. So we want to take the ability away from the users to save the data at all. In order to do that I need to clear the data (purge) when the user hist save, i believe. If I do not work with the same session, then it would not be very helpful.
    We explored the option of "Refresh on open" option, but that requires the installation of Fixpack 3.2, which could take a while, as we have shared BO environments with other applications in the firm, and we cannot wait for that.
    Also, since you mentioned that it might not ensure security or consistency of the reports, what kind of issues could be expected as a side effect of reusing the session ?
    I appreciate your insight Ted.
    Thanks,
    Santosh

  • Getting Bad request error while trying to get a specific document details from c#.

    Hi,
    While trying to retrieve a specific document details using RESTful WS API from C#, it is throwing "The remote server returned an error: (400) Bad Request" exception.
    the request URL i am using for this is like;  "http://<Server>:6405/biprws/raylight/v1/documents/1111"
    But it is working fine, if i change my request URL to get the dataproviders of the same document like; "http://<Server>:6405/biprws/raylight/v1/documents/1111/dataproviders"
    Please let me know if i am missing any thing in first case, getting the details of a specific document, while sending a request to RESTful SDK.
    Thanks,
    Kalyan

    I think you are using “Content-Type” header or an “Accept” header.
    You should be using “Accept: application/xml” for that request
    - Ludek
    Senior Support Engineer AGS Product Support, Global Support Center
    Canada
    Follow us on Twitter

  • Could not retrieve the document with the passed obsolete token.

    Hi,
    Issue is with the specific report not able to execute when the query is cancelled and getting an error when you are cancelling an already executing query.
    Receiving an error message during running one of our report in the
    following way:
    - Run the Webi report
    - Select the value for 8 prompts
    - Click on cancel
    - try to re-run by clicking on re-fresh and receive an error message.
    The error message is the following:
    "Could not retrieve the document with the passed obsolete token (Error: RWI 00323) (Error: INF)"
    Till now we have made the following changes:
    This might be caused by a storage token that identifies a document state, which is no longer available in the storage tokens stack.
    In the webi.properties file, increased the value of storage tokens stack size.
    1. Edit the webi.properties file found in the following location:
    u2022 <Installed dir>\program files\businessobjects\BOenterprise115\Web services\en\dsws_webservice_boe\data\asemble\dsewsBobjJava\src\WEB-INF\classes\webi.properties.
    2. Add or change the following variables:
    u2022 WID_FAILOVER_SIZE (This sets the maximum number of tokens to keep in memory. It is 10 by default.)
    u2022 WID_STORAGE_TOKEN_STACK_SIZE (this sets the maximum number of tokens stored on disk. It is 10 by default.)
    u2022     Deleted cookies.
    u2022     Add  the Java Runtime Parameter value from following path:
    Start - > Control Panel-> Java -> Java Applet Runtime Settings
    Click on View.
    Add the Java runtime Parameter value: Xmx200.
    It is not a machine specific issue however it is intermittent.
    Please advice.
    Regards,
    Pradnya Kokil

    Hi Pradnya,
    Following solutions might help you to resolve the issue.
    Solution1:
    To achieve optimum performance, the developer should limit the number of new windows that can be opened using the OpenDocument function, particularly if using it within the drill function.
    If you must open a new window each time, you can increase the number of document instances available on the system by modifying parameters in the webi.properties file:
    1. On the Business Objects server, navigate to the following directory:
    C:\Program Files\Business Objects\Tomcat\webapps\businessobjects\enterprise115\desktoplaunch\WEB-INF\classes
    2. Open the webi.properties file using a text editor.
    3. Uncomment the FAILOVER_SIZE=10 line by removing the # from the beginning of the line.
    4. After FAILOVER_SIZE, add the following:
    STORAGE_TOKEN_STACK_SIZE=40
    5. Save the file.
    6. Restart the application server
    Solution2:
    Do not use Control Key + N or File New from Browser for invoking new instance of Browser
    Avoid opening Infoview by Hyperlinks.
    Alternatively, by setting logontoken.enabled property in web.xml for desktop.war, will stop users allowing using old token
    Locate web.xml file in desktop.war file deployed on your application server
    Locate the following string in web.xml:<param-name>logontoken.enabled</param-name>
    Change the <param-value> for logontoken.enabled from true to false (forexample, <param-value>false</param-value>)
    Save and close the file
    Restart the web application server to apply the changes
    Regards,
    Sarbhjeet Kaur

  • Workflow Functional Specification Document

    Hi All
    I am working on a implementation project which includes Workflows. Right now I am in the process of writing the functional specification document for the Workflows. I am a functional consultant and never worked on workflows.
    Can some one provide me what should be included in the functional document , how should the flow be written.
    Is there any sample Workflow template anyone can share.
    There are 4 places that requires workflows according to my understanding as described below in my requirement:
    1. Workflow for corporate users when a notification is created or closed
    2. Workflow email, forward a complaint to
         Finance Manager
         Quality Manager
         Plant Managers
    3. Workflow for forwarding to an approver, reassign task to someone else
    4. Workflow to send remainder emails for open items longer than 30 days
    Please provide your insights and neccesary documentation to start
    Thanks,
    Sai

    HI Prakash,
    Thanks for the detailed response, it helped me a lot.
    for approval to sales director, operations director and quality director an email has to be triggred simultaneously.We have predefined list depending on plant who can take corrective action and who can approve the corresponding task. Further users should have the option to select who should get the email.
    For Approver Determination:
    Case 1:  In your scenario approver is not fixed.The approvers get selected based on plant. Try to get link between plant and all the approvers. The easy approch will be to maintain the approvers SAP ID in Z-Table against all the plant and developer will use RULE to fetch approvers from this Z-Table. The structure of Z-Table will be:
                                      PLANT     LEVEL   OBJID     USERID
    For one plant 3 entry will be maitained here. LEVEL will help to identify the 3 types of approvers i.e. sales director, operations director and quality director. OBJID value will be US (if SAP ID will maintained in USERID), O (if Org. ID will maintained in USERID), S (if Position will maintained in USERID) etc. Benifit of this approch will be when ever you want to change any approver you have to change corresponding entry in this Z-Table no need to do changes in Workflow (As suggested by Ronen).
    I used the same logic, creating a Z-Table for agents who has to approve the corrective action for taks completed. I was curious if there is a standard way to get this functionality in SAP. I am not sure about the responsibility rule that Mike was mentioning. Can you tell me which approach is a better design.
    Case 2: Now I am confused since you said user can choose next level of approver. So please explain in which scenario Approver will come based on plant and in which scenario user will choose it manually. If user have to choose manually then a screen design is require. From approval screen based on user selection you need to pass the Approver in workflow.
    Sorry for not putting things clealy. There are no levels for approval. Each of them are independent i.e. Sales director , Operations Manager and Quality director should get emails for approval after the Plant Manager, QA, Manager, Sales Coordinator take corrective action and the notification is closed only when all 3 of them approve the corrective action.
    The user have to choose manually when the correspondng approver of that plant left the company, long vacation, took a new role etc...
    Mail Notification:  Extended mail notification functionaity is there. The person who will get work item in his/her SAP inbox for approval they will get mail notification in their external mail ID. All the approvers email id should be maintained along with their SAP ID in T-Code SU01. You Just need to provide mail contents in your FS, workflow developer will put same text in in mail body.
    I was thinking about the SO23 distribution list for sending the emails to approvers. Also, how do the emails go to the corresonding approvers of that specific plant unless we explicity specify the email id's associated with that plant. Please clarify.
    Thanks,
    Sandeep

  • Hide the delete menu item from a specific document library

    I want to hide the Delete  item menu option for a specific document library.Since it is for a specific library I would not like to use customcore.js approach.Please suggest some useful javascript for same.
    I have a custom delete action associated with the menu which performs other function as well so need to hide the OOB delete option from the item  menu of a document library.
    I have already used below javascript in CEWP which I added on the document library page itself(allitems.aspx) but yeild no results:
    <script type="text/javascript">
    var elemTable=document.getElementById('ECBItems');
    if (elemTable !=null) {
         var elemTBody=elemTable.childNodes[0];
    //iterate each table row to find the correct ECB menu item to hide(remove)
       for (var iMenuItem=0; iMenuItem < elemTBody.childNodes.length; iMenuItem++) {
             var elemTR=elemTBody.childNodes[iMenuItem];
             var elemTDTitle=elemTR.childNodes[0];
             var title=GetInnerText(elemTDTitle);
     //here we filter on title, but the table contains more information if need be
            if(title =='Delete') {
                 elemTBody.removeChild(elemTR);
    </script>
    Please suggest which can be kept specific and requires no change in masterpage as same masterpage is used across the site.

    Hi justSP,
    Greetings.
    Hope the below links help you
    http://social.technet.microsoft.com/Forums/office/en-US/9adea3a2-6d08-4c04-ace2-88a704833f1d/how-to-hide-delete-item-from-ecb-menu-for-1-specific-custom-list?forum=sharepointcustomizationlegacy
    http://chakkaradeep.com/index.php/sharepoint-hiding-menu-items-from-the-edit-control-block/
    http://social.technet.microsoft.com/Forums/office/en-US/1b832635-4ae7-4f31-826c-2d6b834ece52/hide-delete-from-ecb-menu-for-a-specific-document-library-in-sharepoint-2010?forum=sharepointcustomizationprevious
    http://social.technet.microsoft.com/Forums/office/en-US/919e01e6-9a7a-4439-b778-28e0dc8bffba/how-to-hide-delete-option-from-ecb-menu-in-document-library-in-sharepoint-2010?forum=sharepointdevelopmentprevious
    Please remember to click 'Mark as Answer' on the answer if it helps you

Maybe you are looking for

  • ECC Report

    Hi Experts, In our project we have created some ECC Reports. The names of report are Application Report BEE Report Cost Center Report Cost Center YTD Report Material Analysis - MC.9 Purchase Orders By Vendor Total Cash Flow Per Month Report We have t

  • "Could not be copied because an error occured. There is not enough memory."

    Hello, I recently got an iPad 64gb. And have since been loading all of my Comic backups onto it (Via Cloudreaders). I've got 32.5gb used and 26.4gb Free. Every 20-30 issues or so I get an error that says "Comic book name here" cannot be copied becaus

  • Help plz cause our prof won't help us

    ok, due to the fact that our professor Java feels himself way to god to give us (my class and I) an answer I post it here. //It's in Dutch but you should figure it out. class Kaart private final String[] color = {"zwarte","witte"}; private final Stri

  • Firefox goes into Safe Mode when I don't want it to

    Sometimes, usually while doing Javascript development, I will quit out of Firefox to escape from a lengthy process (e.g. an "alert" message embedded in a loop). This is a nice feature, BTW, better than having to "force quit," but when I restart it of

  • Anyone figured out how to get rid of the address bar tooltips??

    I asked this about a year ago. One guy responded with some editing tips using the developer tools, but did not mention how to get to the files to edit them (he was recommending using Interface Builder). I cannot understand why there isn't a preferenc