cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Query display Number of pages per document

Todd_Priest
Star Contributor
Star Contributor

I have a customer that is looking for a way to run a Custom Query and display the number of pages for each of the documents. Is there any way to do this. Custom SQL query?

Thanks

11 REPLIES 11

Todd_Priest
Star Contributor
Star Contributor

Seth, I am using your script you created everything is set up in Unity API and was able to save an published successfully Added my keyword of page count to the documents. Created a System WF to run action (run unity Script) Choose my new script. I am getting an error in Diagnostic console

Document lock not Obtained "source line 59 - GetAndStorePageCount.GetandStorepageCount - OnworkflowExecute

line 49 ' Lock document: using statement handles disposal of DocumentLock object and releases lock

line 51 ' Alternatively, DocumentLock.Release may be called to release the lock

Line 53 Using documentLock As DocumentLock = document.LockDocument()

Line 55 ' Ensure lock was obtained

Line 57 If (documentLock.Status <> DocumentLockStatus.LockObtained)Then

Line 59 Throw New Exception("Document lock not obtained")

Seth_Yantiss
Star Collaborator
Star Collaborator

Todd,

My initial thought is that if you already have a document lock on the document via the viewer and then the script tries to establish a new lock, it would fail (like opening the same document in two different viewers in any of the clients) even though it's the same user.

Can you create a lifecycle and then a WF Timer that runs the Unity script?

Take a look at this screen print:

I don't mind making your life easier by sending you an export of my LC.  You'd need to apply your document type to the LC though, or create a System Task to add the selected docs to the new LC.

Cheers, Beer 
Seth 

Seth_Yantiss
Star Collaborator
Star Collaborator

Todd,

You also might be able to remark out the lock process from the script and have it work...  That might not work, though...

Joe_Pineda
Star Collaborator
Star Collaborator

Seth: thanks for the script. I have a feeling that's going to come in handy. Couldn't he just add code to clear any existing locks before he tries to obtain a new one? Assuming of course, this is not  permissions issue with with the account running the action on the disk group...

Seth_Yantiss
Star Collaborator
Star Collaborator

[quote user="Jose Pineda"] Couldn't he just add code to clear any existing locks before he tries to obtain a new one?

Possibly.   The way that he's running the script (System Task, as I understand it) should take into account his own personal lock on the document, so perhaps it's something else.  

Since he's able to retrieve the document in the Unity Client, I have to presume that the APP Server has the correct permissions to the Disk Group.