Hi All:
Does anyone know how EPDM goes about renaming a file checked into EPDM for actual storage on disk? What internal database tables does the appropriate file check in API access for determining where to place the new file out on the system storage location? I'm writing a web interface that will query EPDM tables directly for meta data created with files but I can't figure out where to actually go get the stored image of the file I'm getting meta data on.
Any help is appreciated.
Thanks
James
SolidworksApi macros
James,
Look at the chapter called "On-Demand Replication" in the EPDM Replication Guide.
Michael:
Thanks for the timely response. I just looked at that chapter and I see the discussion about how the files are actually archived. That's very helpful but I still need to understand how to get from a DocumentID or Filename to that actual folder and file name on the archive server directory.
So let's assume that you have a file called foo.zip and you inspect the Documents table and it has a DocumentID of 101. How/where is the information stored that tells me how to actually get to that physical document out in the archiveserver directory tree?
Thanks
James
First you need to convert the DocumentID from decimal to hexidecimal. 101 is equal to 65 in hex. You pad this with zeros to give you a value that is 8 digits long, so 00000065. Your files will be in the folder\5\00000065.
Michael:
Thank you very much. That's exactly what I needed. I thought it looked something like that but I wasn't sure how to decode it. So just to be sure I understand things, if I have DocumentID = 101622 that is 16CF6 in hex. So my directory is:
Now inside that directory are two files, an Index.xml and my file with file name of 00000001. The actual contents of the xml index file is as shown below:
xml version="1.0" ?>
- <index version="9.0">
<version id="1" uid="177087" date="2012-01-31 12:47:34" />
<version id="2" ref="1" uid="177088" date="2012-01-31 12:47:36" />
<version id="3" ref="1" date="2012-01-31 12:47:38" />
index>
Since there's only one file, its no problem to retrieve it. But what if there was more than one file? I'm assuming this would indicate that each of the files represents different versions of the file that were created and by getting the one with the highest number, 2,3,4, etc. then I am getting the most current version.
Am I correct? Can you tell which file to retrieve based upon the index.xml file?
Thanks
James
Yes. In this case the file you want is 00000003.pdf to get the current version.
I am guessing you only have one file in that directory called 00000001.pdf in your index file version id 3 has a ref=1 that means you need to use file 1,
My question is I need to know where in the Database is this Version referenced back to 1?
i created this sql statement, which gets me to 00000003.pdf in your example above, i need to know how to modify it to look at the reference if one exist (within the database).
SSQL = "SELECT DocumentID, Filename, Description, Vault_Path FROM CT_Documents WHERE DocumentID = " & CLng(nDocNum)
this is the CT_Documents view:
SELECT d.DocumentID, d.Filename, d.LockProject, d.UserID, d.LockDomain, d.LockPath, d.Busy, d.Flushed, d.DefValStored, d.RevGenCounter, d.LatestRevisionNo,
d.CurrentStatusID, d.WorkingVersionModified, d.ExtensionID, d.LockDate, d.UserDocRefsModified, d.Deleted, d.Shared, d.LockViewID, d.Link, d.DocTypeID,
d.ObjectTypeID, d.Flags, dbo.acFindAnyVariableValueBOM(N'Description', d.DocumentID, d.LatestRevisionNo) AS Description,
'\\sql\epdm_vault$\C_ePDM\' + RIGHT(sys.fn_varbintohexsubstring(0, CONVERT(binary(4), d.DocumentID), 1, 0), 1) + '\' + sys.fn_varbintohexsubstring(0,
CONVERT(binary(4), d.DocumentID), 1, 0) + '\' + RIGHT(sys.fn_varbintohexsubstring(0, CONVERT(binary(4), d.LatestRevisionNo), 1, 0), 8)
+ '.' + fe.Extension AS Vault_Path
FROM dbo.Documents AS d LEFT OUTER JOIN
dbo.FileExtension AS fe ON d.ExtensionID = fe.ExtensionID
What is the logic behind the way the folders are named?
Thanks!
Robert,
James answered this in his last post, "if I have DocumentID = 101622 that is 16CF6 in hex. So my directory is:\6\00016CF6"
Mike
CEPA