Docbasic Script to create an excel file

shyam1104543
edited December 18, 2008 in Documentum #1

Hi,

Can anyone please provide me the script to create an excel sheet which stores all the values coming to repository from a registered table.

Also, can anyone provide me a link to Docbasic tutorial if any.

Thanks in advance.

Shyam.

Comments

  • Francois Dauberlieu
    edited November 17, 2008 #2

    The docbasic doc can be downloaded from the EMC Download Center.

    Basically, it's a subset of VB that allows you to run API command therefore you'd need ot run the API command to read your table and create the doc

  • hcodpleh
    edited December 12, 2008 #3

    How can I download the document about the Docbasic? I have an account but when I try to find Docbasic, the result is empty.

    Could you help?

    Thanks

    Romuald

  • Francois Dauberlieu
    edited December 14, 2008 #4

    Not sure but if my memory serves me well, it used to be included in the zip file when downloading the content server stuff

  • hcodpleh
    edited December 18, 2008 #5

    I did not find it. Is somebody has a copy and mail it to me?

    Thanx!

  • Chris_Campbell
    edited December 18, 2008 #6

    There's more than one way to solve this problem.  Whatever the method, you're going to end up creating a CSV file that Excel can easily open and convert for use.  Sure you could go about using a control to actually create the .xls file format, but that's a pain in the neck.

    A few quick notes about DocBasic.  I absolutely love it.  Quick, easy and easy to debug.  That being said, it's limited in where it can run (Documentum Desktop or from the Content Server) and it's scheduled to be deprecated in Documentum 7.  I use DocBasic for simple administrative scripting or reports, but for any scheduled jobs or batches or frequently used methods, writing a Java method is going to be the best long term solution.  Keeping the above in mind, I would use DocBasic only if the user has Documentum Desktop.

    If you're determined to use DocBasic, there's actually two ways to go about it.  The first is a DocBasic script, which I'll get to in a second.  The second is to use the Find Documentum Items (which can be used from Webtop) or a Smartlist.  Create a search looking for your custom type.  In the display settings, add the columns that you'd like to show in your report.  Click "Print List" but check the Print to File box.  Now you can save the result as a CSV file that can be opened in Excel.  You can save your search to use whenever you want.

    If you want to write DocBasic... well, it's pretty much going to look something like this:

    Sub Main()

    dim col1 as object

    Open "C:\output.csv" For Output Access Write As #1

    Print #1, "Header 1,Header 2, Header 3"

    dql = "select * from some_registered_table header_1, header_2, header_3"

    col1 = dmAPIGet("readquery,c," + dql)

    While dmAPIExec("next,c," + col1)

         sHeader1 = dmAPIGet("get,c," + col1 + "header_1")

         sHeader2 = dmAPIGet("get,c," + col1 + "header_2")

         sHeader3 = dmAPIGet("get,c," + col1 + "header_3")

         Print #1, CStr(sHeader1) + "," + CStr(sHeader2) + "," + CStr(sHeader3)

    Wend

    status = dmAPIExec("close,c," + col1)

    Close #1

    End Sub

    I wrote that off the top of my head and it doesn't include any connection routines, so it will only run in the Desktop DocBasic debugger.  I'll also upload a copy of the Docbasic Reference Manual.  Best of luck.

  • hcodpleh
    edited December 18, 2008 #7

    Thankx very much Chris.

    have a good day

    Rom

  • Chris_Campbell
    edited December 18, 2008 #8

    It used to be in the Documentum Developer Studio section.  The manual hasn't been updated since 4.0 so I'm not suprised if it's disappeared.  In a pinch, you can access the .chm from DAB.  (From DAB choose Help -> Documentum Application Builder Help)  If you don't see a Docbasic section, then DCTMDev.chm wasn't opened.  Just search for it and open it.

    One other bit of trivia: DocBasic is just BasicScript with some DQL tacked on.  The DocBasic Reference manual isn't the complete BasicScript manual.  (I just so happen to have the full manual, but can't upload it or share it until I can check on any copyright holder info.)  Search Google or your own company archives and you might find a manual floating out there.  There's another 40% of functionality hidden away that isn't documented in the manuals supplied by Documentum way back in '99.  Shame too, because you could build a whole GUI around DocBasic and then bypass Rightsite (aka Webtop back in the day).  Made everything much much faster in certain respects.  Also true for certain cases in 5.3.  Can't say the same anymore with the 6.x architecture changes.  Glad to see those days finally come to an end.