cancel
Showing results for 
Search instead for 
Did you mean: 

DMCoreX get raw file location...

Josh_Belmonte
Champ on-the-rise
Champ on-the-rise

I have methods to do this in Classic but in an on-going effort to be cross-platform compatible I need some assistance in casting the raw document location into a string. Even in classic VBS I can only get 'subpath' and not including the full diskgroup location... Is there a method for this?

Basically I'm trying to e-mail the document as an attachment to a user based on a keyword value.

'Classic

    Set objDocumentPageCollection = objCurrentDocument.Pages
    Set objPageItem = objDocumentPageCollection.Item(ITEMNUM)    
    strSubPathofPage = objPageItem.SubPath

4 REPLIES 4

Scott_McLean
Elite Collaborator
Elite Collaborator

Hi Belmonte,

Two part answer. First, no, there isn't a method to return the disk group path for the document. However, you could execute a SQL query to return the disk group path from any of the APIs. The programming language used in your selected API will determine how you would code your database query. The query itself would be something like this:

SELECT RTRIM(ppl.lastuseddrive) + RTRIM(idp.filepath)
FROM hsi.physicalplatter AS ppl
INNER JOIN hsi.itemdatapage AS idp
ON ppl.diskgroupnum = idp.diskgroupnum AND ppl.logicalplatternum = idp.logicalplatternum
WHERE idp.itemnum = YOUR_DOCUMENT_HANDLE AND ppl.physicalplatternum = 1

Second, and more important, the core API has been deprecated. After version 14 it will no longer exist. So making efforts to write to the old core API now may not be the best choice. I would recommend investigating the Unity Automation API, as that will be the recommended API for core-based scripting going forward.

Kind regards,

-Scott

Ian_Cordova
Champ on-the-rise
Champ on-the-rise

Hi Josh,

Thank you for your inquiry!

I apologize for the repeat message but I want to ensure communication of support of DMCoreX for the Hyland Community.

Depending on version of OnBase you are on, I would recommend migrating your VBScripts to Unity Scripts.  The biggest reason is that the end of life of DMCoreX API is targeted for December 31, 2014 and has already been marked as deprecated.  DMCoreX API is being replaced by Unity API.  More information about Product Support Lifecycle & End of Life Schedule can be found here.

In regards to your question, I would suggest not to retrieve documents directly from the OnBase disk groups but to retrieve the document through the API interface.  The are several reasons for this but most importantly:

1) Data integrity - This will prevent code from accidently moving or deleting a file from disk group. 
2) File Format of requested document - There are instances where the document stored in the disk group may not be want you expect or have a different file extension.  An example of this are E-Forms.  In the disk group, we store an HTM file however if you open up the HTM file you will only see the post data of the form and not the HTML itself.  Another example would be a COLD file.  OnBase stores the entire COLD index file in the disk group and OnBase will know how to parse the file to retrieve a specific document. 

With that being said, I would recommend leveraging IOBXPresentationServices for document retrieval purposes.  You can then obtain the IOBXDocumentDataProvider object to then call IOBXDocumentDataProvider::GetDocument() method. 

To answer your question directly below is the code to get the relative path for a specific page of a document.

Function Main(oSession, oDocument)        ' Obtain the Page Collection    Dim oDocumentPageCollection    Set oDocumentPageCollection = oDocument.Pages    Dim i    ' Iterate through the page collection    For i=0 to oDocumentPageCollection.Count-1        Dim oDocumentPage        Set oDocumentPage = oDocumentPageCollection.Item(i)        ' Get the pages relative path to as it is stored in the disk group        Dim strRelativePath        strRelativePath = oDocumentPage.RelativePath                 Set oDocumentPage = Nothing        Next

 

Please note that the ability to retrieve the document physical path is not available in Unity API and uses the approach I recommended above by using the API interface to retreive a document from OnBase.  Below is a code snippet of retrieving a document through Unity API.  It assumes the implementer is asking for the document back as an image (TIFF)

using(PageData pageData = app.Core.Retrieval.Image.GetDocument(args.Document.DefaultRenditionOfLatestRevision)){       string tempFilePath = String.Format(@"{0}\{1}.{2}", System.IO.Path.GetTempPath(), args.Document.ID, pageData.Extension);	Hyland.Unity.Utility.WriteStreamToFile(pageData.Stream,tempFilePath);}

I hope this helps!

Thanks,

Ian Cordova
Custom Solutions Group - Team Lead

 

Nathan_Kossover
Star Contributor
Star Contributor

Josh_Belmonte
Champ on-the-rise
Champ on-the-rise

Thank you very much everyone for the excellent information!!

We are only talking Unity API atm - but we do indeed need to get ready for this switch. We are currently on OnBase12.